[Issue 16160] New: selective imports in aggregation shadow @property functions

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jun 10 13:13:13 PDT 2016


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

          Issue ID: 16160
           Summary: selective imports in aggregation shadow @property
                    functions
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: rburners at gmail.com

struct Foo {
    import std.array : empty;

    @property bool empty() {
        return true;
    }
}

unittest {
    Foo f;
    assert(f.empty);
}

Error: expression f.empty of type void does not have a boolean value
It seams like the import of std.array.empty is shadowing the empty @property.
Moving the import out of the struct fixes the problem.

--


More information about the Digitalmars-d-bugs mailing list