[Issue 9125] New: mixin + textual import = order of declaration dependence

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 8 14:29:12 PST 2012


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

           Summary: mixin + textual import = order of declaration
                    dependence
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dmitry.olsh at gmail.com


--- Comment #0 from Dmitry Olshansky <dmitry.olsh at gmail.com> 2012-12-08 14:29:10 PST ---
Created an attachment (id=1166)
code sample that gets mixed in 

The test case are 2 files one is main and the other is being mixed in via
import("tables.d").

command line:
dmd -J. -c mixin_order.d

dmd is 2.061 from github master.

struct RleBitSet(T)
{
    this(const(T)[] arr)const{ }
}

auto asSet(T)(in SetEntry!T e)
{
    return RleBitSet!T(e.data);
}

//this way works 
//mixin(import("tables.d"));

immutable NFCN = asSet(NFC_QCN);
immutable NFCM = asSet(NFC_QCM);

//this doesn't
mixin(import("tables.d"));


//-------------------
// tables.d (also attached)
//-------------------
struct SetEntry(T)
{
    T[] data;
}

immutable NFC_QCN = SetEntry!uint([1,2,3,4]);
immutable NFC_QCM = SetEntry!uint([1,2,3,4]);


It is expected that mixin(import("...")) makes code appear to be effectively
pasted just there but obviously some processing step is missing as it doesn't
work this way.

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