www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9650] New: __traits(compiles) + mixin

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9650

           Summary: __traits(compiles) + mixin
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: callumenator gmail.com


--- Comment #0 from callumenator gmail.com 2013-03-05 08:52:27 PST ---
DMD2.062:

http://forum.dlang.org/thread/vnnmmwhoyrdtbglqxqkz forum.dlang.org#post-tdojcnsrtkygjbhwegph:40forum.dlang.org

import std.conv;

void main()
{
    enum s = "`1`.to!int;";
    enum c = __traits(compiles, mixin("{auto a = new "~s~";}")); // line 1
    mixin("auto a = "~s~";");  // line 2
}

Long errors about instantiating std.conv.to!(int).to!(string). Swap lines 1 and
2 and compilation succeeds. This worked in 2.061. Possibly related to issue
9017.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 05 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9650


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-03-08 02:02:27 PST ---
https://github.com/D-Programming-Language/dmd/pull/1728

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 08 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9650



--- Comment #2 from github-bugzilla puremagic.com 2013-03-23 12:19:57 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/ac89791f2a4c54cb255ee7e802fde74643b12412
fix Issue 9650 - __traits(compiles) + mixin

I couldn't minimize test case, but the bug fix is obvious.

The bug had been hiding for a long time, but recent Phobos change
(https://github.com/D-Programming-Language/phobos/commit/2a88fea7867f33fd1cf15c2dca7790a3c8aea474)
had exposed the bug.

When a mixin expression gets invalid code string, the parsing error had not
handled correctly. In such case, it had generated *invalid* AST instead of
returning ErrorExp. I guess that the invalid AST would report weird error in
later semantic analysis.

I think that both CompileDeclaration and CompileStatement do not have same
problem. So they are not changed.

https://github.com/D-Programming-Language/dmd/commit/618d8277aaf20c9f8d8eebc39289e3d2a1c63d42
Merge pull request #1728 from 9rnsr/fix9650

Issue 9650 - __traits(compiles) + mixin

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 23 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9650



--- Comment #3 from github-bugzilla puremagic.com 2013-03-23 12:22:13 PDT ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/a4de3b4e56fd70e0982eed2a55abdc6df20d18db
Merge pull request #1728 from 9rnsr/fix9650

Issue 9650 - __traits(compiles) + mixin

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 23 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9650


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
            Version|D2                          |D1 & D2
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 23 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9650



--- Comment #4 from github-bugzilla puremagic.com 2013-03-23 12:26:02 PDT ---
Commit pushed to 2.062 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/f62c899fecf3ab58e9d20d1b413bfb06f0d26a95
Merge pull request #1728 from 9rnsr/fix9650

Issue 9650 - __traits(compiles) + mixin

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 23 2013