[nem-bug] [Nemerle 0000795]: Inconsistent tuple type unification

feedback at nemerle.org feedback at nemerle.org
Mon Nov 27 08:09:59 CET 2006


A NOTE has been added to this issue.
======================================================================
<http://nemerle.org/bugs/view.php?id=795> 
======================================================================
Reported By:                Evin Robertson
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   795
Category:                   Compiler (type engine)
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             11-27-2006 03:44 CET
Last Modified:              11-27-2006 08:09 CET
======================================================================
Summary:                    Inconsistent tuple type unification
Description: 
public class A
{
}

public class B : A
{
}

public class C
{
    public F(x : int) : int * B
    {
        (x, B());
    }

    public G() : int * A
    {
        def (y, b) = F(1);
        (y, b);
    }

    public H() : int * A
    {
        F(1);
    }
}

Observed result: G() compiles fine, but H() gives an error:
pairunify.n:22:5:25:6: error: expected (int * A), got (int * B) in
function return type: the types A and B are not compatible [simple unify]

It doesn't seem like taking apart a tuple and putting it back together
again should be required for this to compile.  Because tuples are
immutable, (int * B) should be considered a subtype of (int * A).

======================================================================

----------------------------------------------------------------------
 nazgul - 11-27-06 08:09 
----------------------------------------------------------------------
> It doesn't seem like taking apart a tuple and putting it back together
again should be required for this to compile. Because tuples are
immutable, (int * B) should be considered a subtype of (int * A).

Tuples in Nemerle are invariant. This is a limitation of .NET generics :(

Issue History
Date Modified  Username       Field                    Change              
======================================================================
11-27-06 03:44 Evin Robertson New Issue                                    
11-27-06 08:09 nazgul         Note Added: 0001523                          
======================================================================




More information about the bugs mailing list