[Issue 8287] New: When a class with the same name as a module exists within that module and has static members, you're required to do modulename.classname.member() in order to access said members

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 23 03:22:06 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8287

           Summary: When a class with the same name as a module exists
                    within that module and has static members, you're
                    required to do modulename.classname.member() in order
                    to access said members
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: tbrisbane at hotmail.com


--- Comment #0 from Trey Brisbane <tbrisbane at hotmail.com> 2012-06-23 03:24:09 PDT ---
Pretty much exactly what the summary says. Here is an example:

File 1:
module objectA;

class objectA {
  public static void doSomething() {
    ...
  }
}

File 2:
module main;

import objectA;

int main(string[] args) {
  objectA.doSomething(); // Error: undefined identifier 'doSomething'
  objectA.objectA.doSomething(); // Ok
  return 0;
}

Obviously, the compiler is searching for a function called doSomething in the
module objectA, when it should instead recognize that a class called objectA
has been imported and an attempt is being made to access its static member
doSomething().

Please note that this is my first bug submission, so if it's already known (I
did search before posting this) or has a simple fix, please forgive me. :)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list