www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14391] New: Assigning to module results in unhelpful error

https://issues.dlang.org/show_bug.cgi?id=14391

          Issue ID: 14391
           Summary: Assigning to module results in unhelpful error message
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: thecybershadow gmail.com

/// a.d ///

module a;
int a;

/// b.d ///

import a;
void main()
{
    a = 42;
}

///////////


Compiler says:

b.d(4,5): Error: a is not an lvalue

Ideally, it should say something along:

b.d(4,5): Error: cannot assign to module "a", did you mean "a.a" of type "int"?

--
Apr 01 2015