www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3682] New: is expression fails to match types

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

           Summary: is expression fails to match types
           Product: D
           Version: 2.038
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: snake.scaly gmail.com


--- Comment #0 from Sergey Gromov <snake.scaly gmail.com> 2010-01-06 14:54:38
PST ---
contents of "a.d":
import std.typecons;

contents of "b.d":
import std.typecons;
alias Tuple!(int) tint;

compile like this:
dmd -unittest a.d b.d

error message:
C:\opt\dmd.2.038\windows\bin\..\..\src\phobos\std\typecons.d(424): Error:
static assert  (is(Tuple!(string,float) == Tuple!(string,float)))
is false
C:\opt\dmd.2.038\windows\bin\..\..\src\phobos\std\typecons.d(413):       
instantiated from here: Tuple!(string,float)
C:\opt\dmd.2.038\windows\bin\..\..\src\phobos\std\typecons.d(423):       
instantiated from here: slice!(1,3)
C:\opt\dmd.2.038\windows\bin\..\..\src\phobos\std\typecons.d(420):       
instantiated from here: Tuple!(int,string,float,double)
b.d(2):        instantiated from here: Tuple!(int)

This is a regression from 2.037.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 06 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3682


Alexey Ivanov <aifgi90 gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aifgi90 gmail.com


--- Comment #1 from Alexey Ivanov <aifgi90 gmail.com> 2010-01-24 09:18:05 PST
---
If compiled like "dmd -unittest b.d a.d" or "dmd a.d b.d", it compiles fine,
but fails with "dmd -unittest a.d b.d"

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 24 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3682


Rainer Schuetze <r.sagitario gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario gmx.de


--- Comment #2 from Rainer Schuetze <r.sagitario gmx.de> 2010-02-14 07:24:26
PST ---
I've debugged this issue a bit: it seems to have to do with the unittest inside
struct Tuple(T...) auto inferring the return type of Tuple.slice(). This
triggers a recursive semantic analysis, which results in the template instance
not being resolved (the type stays qualified as TemplateInstance).

A simple workaround is moving the unittest out of the template definition of
Tuple.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 14 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3682



--- Comment #3 from Don <clugdbug yahoo.com.au> 2010-08-24 12:39:36 PDT ---
Reduced testcase shows that it doesn't require -unittest, and it is D2-only.

--- a3682.d--------------

struct Tuple(Types...)
{
    Tuple!(Types[0..1]) slice()()
    {
        Tuple!(Types[0..1]) x;
        return x;
    }

    void fail()
    {
        Tuple!(float, double, int) a;
        auto s = a.slice();
        static assert(is(typeof(s) == Tuple!(float)));
    }
}

---- b3682.d--------------

import a3682;
alias Tuple!(int) tint;
--------------------------

 dmd a3682 b3682
a3682.d(14): Error: static assert (is(Tuple!(float) == Tuple!(float))) is false a3682.d(4): instantiated from here: Tuple!(float) a3682.d(13): instantiated from here: slice!() a3682.d(12): instantiated from here: Tuple!(float,double,int) b3682.d(2): instantiated from here: Tuple!(int) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 24 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3682



--- Comment #4 from Don <clugdbug yahoo.com.au> 2010-09-29 00:27:01 PDT ---
Caused by svn 318, which was fixing bug 282 "Bizarre circular import nested
name invisibility issue". Regression bug 4543 was introduced at the same time.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 29 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3682


Iain Buclaw <ibuclaw ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw ubuntu.com


--- Comment #5 from Iain Buclaw <ibuclaw ubuntu.com> 2011-03-24 12:08:10 PDT ---
The (new?) error message I get from the reduced testcase is:

a3682.d(12): Error: cannot implicitly convert expression (a.slice()) of type
Tuple!(float) to Tuple!(float)

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |WORKSFORME


--- Comment #6 from Walter Bright <bugzilla digitalmars.com> 2012-03-02
12:51:49 PST ---
It works with D2 2.059 head

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |


--- Comment #7 from Don <clugdbug yahoo.com.au> 2012-03-08 02:01:32 PST ---
The test case in comment 3 still fails for me with 2.059 head.

Note that the compilation order is important:
dmd a3682.d b3682.d fails, but dmd b3682.d a3682.d works.

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



--- Comment #8 from github-bugzilla puremagic.com 2012-03-09 14:25:02 PST ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/38deee3916b4158b858c6e03dd5aac8dea377f19
fix Issue 3682 - Regression(2.038) is expression fails to match types

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



--- Comment #9 from github-bugzilla puremagic.com 2012-03-09 14:27:05 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/804dc3b28752673ed402c5ec0ad9aa3cacf4f374
fix Issue 3682 - Regression(2.038) is expression fails to match types

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #10 from Walter Bright <bugzilla digitalmars.com> 2012-03-09
14:27:45 PST ---
This one took many hours to track down :-)

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



--- Comment #11 from github-bugzilla puremagic.com 2013-01-03 00:42:41 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/117dbe3bac35dfa2ab40de4d9f6bbb9015c1b0e8
Add test cass for issue 3682

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