www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21501] New: [REG 2.089.1] undefined identifier in package

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

          Issue ID: 21501
           Summary: [REG 2.089.1] undefined identifier in package when
                    using mixin and cyclic imports
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: tim.dlang t-online.de

//////////////// test/a.d ////////////////
module test.a;
import test.b;
import test.c;

alias Identity(T) = T;

struct A
{
        Identity!(mixin(q{test.c.C})) data;
}
//////////////// test/b.d ////////////////
module test.b;
import test.a;

struct B
{
    A data;
}
//////////////// test/c.d ////////////////
module test.c;

alias C = int;
//////////////////////////////////////////

Running dmd -c test/a.d results in the following error:
test/a.d-mixin-10(10): Error: undefined identifier c in package test, perhaps
add static import test.c;

Running dmd -c test/b.d test/a.d test/c.d instead does not result in an error.
The order of the files is important, because dmd -c test/a.d test/b.d test/c.d
does result in the error.

The error happens with dmd v2.089.1, while it works normally with dmd v2.089.0.
It looks like https://github.com/dlang/dmd/pull/10584 introduced it.

--
Dec 23 2020