[Issue 7605] New: Better error message when variable declaration hides type declaration

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 28 09:22:12 PST 2012


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

           Summary: Better error message when variable declaration hides
                    type declaration
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-02-28 09:22:11 PST ---
module test;

struct Foo { }
void main()
{
    Foo x;
    int Foo;
    Foo y;  // Error: Foo is used as a type
}

Compare the above to this:

module a;
int Foo;

module b;
struct Foo { }

module main;

import a;
import b;

void main() {
    Foo m;
}

main.d(7): Error: a.Foo at a.d(2) conflicts with b.Foo at b.d(2)
main.d(7): Error: Foo is used as a type

The first code example could instead output:
test.d(8): Error: test.Foo at test.d(3) conflicts with test.Foo at test.d(7)
test.d(8): Error: Foo is used as a type

-- 
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