www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8444] New: Cannot use dot to disambiguate between local method and class declaration

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8444

           Summary: Cannot use dot to disambiguate between local method
                    and class declaration
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



17:13:47 PDT ---
module test;
class Foo
{
    void foo(.test.Foo) { }  // should work
    void test() { }
}

void main() { }

test.d(5): Error: identifier 'test' of '.test.Foo' is not defined
test.d(5): Error: .test.Foo is used as a type

Not that it does work if "test" is an *imported* module, e.g.:

module mymod;
import test;

class Bar
{
    void foo(.test.Foo) { }
    void test() { }
}

void main() { }

This compiles.

I'd really like the first case to work because it makes code generation easier
to do (so I'm not talking about handwritten code here). But it's low priority
for me, I can implement workarounds.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 25 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8444


Jonathan M Davis <jmdavisProg gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg gmx.com



PDT ---
Did it work in 2.059? Or is that what you're using? Even if it's minor, if it
worked in 2.059 and doesn't work in 2.0560, it needs to be marked as a
regression.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 25 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8444




17:35:20 PDT ---

 Did it work in 2.059? Or is that what you're using? Even if it's minor, if it
 worked in 2.059 and doesn't work in 2.0560, it needs to be marked as a
 regression.
2.050 is the earliest I've tested but I don't think it ever worked. It's not odd it wasn't found since using 'Foo' would work. This just seems like an edge-case. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 25 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8444


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID



20:17:10 PDT ---
Looking at the DMD code I think my bug report is invalid. Dot looks up in the
module scope, but there's no 'test' in the test module scope (unless it's an
import of another module named 'test').

The OP code needs to use ".Foo" instead.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 03 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8444




20:19:20 PDT ---

 Looking at the DMD code I think my bug report is invalid. Dot looks up in the
 module scope, but there's no 'test' in the test module scope (unless it's an
 import of another module named 'test').
 
 The OP code needs to use ".Foo" instead.
Also if clashes are of concern, the user can use an alias: alias test ThisModule; class Foo { void foo(.ThisModule.Foo) { } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 03 2012