[nem-bug] [Nemerle 0000562]: Assertion for nested generic class with type parameter unifying with parent's generic parameter

feedback at nemerle.org feedback at nemerle.org
Mon Jan 1 17:27:20 CET 2007


A NOTE has been added to this issue.
======================================================================
<http://nemerle.org/bugs/view.php?id=562> 
======================================================================
Reported By:                nazgul
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   562
Category:                   Compiler
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     confirmed
======================================================================
Date Submitted:             11-06-2005 20:28 CET
Last Modified:              01-01-2007 17:27 CET
======================================================================
Summary:                    Assertion for nested generic class with type
parameter unifying with parent's generic parameter
Description: 
using System;

public class Set['a] where 'a : IComparable['a]
{
    private variant Tree['b] where 'b : IComparable['b], 'a
    {
        | Node
        {
            left : Tree['a, 'b];
            elem : 'b;
            right : Tree['a, 'b];
        }
        | Null

        public Insert(x : 'b) : Tree['b]
        {
            match (this) {
                | Node(l, cur, r) when x.CompareTo(cur) < 0 =>
                    Node(l.Insert(x), cur, r)
                | Node(l, cur, r) when x.CompareTo(cur) > 0 =>
                    Node(l, cur, r.Insert(x))
                | Node(_, _, _) =>
                    throw ArgumentException(
                            "Element already exists in the tree");
                | Null =>
                    Node(Null(), x, Null())
            }
        }
    }

    private mutable storage : Tree['a] = Tree.Null();
    
    public Add(x : 'a) : void
    {
        storage = storage.Insert(x);
    }
}

()
======================================================================

----------------------------------------------------------------------
 nazgul - 01-01-07 17:27 
----------------------------------------------------------------------
After applying the attached patch to ommit bug in Validate (this is
probably not the correct way) the deeper problem araise with example:

using System;

public class A ['a] {
  public class B ['b] where 'b : IComparable ['b], 'a {
    public class C : B ['b] { }
  }
}

giving

t.n:5:12:5:32: error: typing constraint on 'b not satisfied, upon
instantiation of A.B: ('a.857 AND System.IComparable['b.858]) is not a
subtype of 'a.855 [simple require]


Apparently TypeInfo.ConstructSubst (tc : TypeInfo, typarms : list
[StaticTyVar],
                           args : list [TyVar], check_parms : bool) :
Subst

should handle intersection types

Issue History
Date Modified  Username       Field                    Change              
======================================================================
11-06-05 20:28 nazgul         New Issue                                    
11-06-05 20:32 nazgul         Status                   new => confirmed    
01-01-07 17:24 nazgul         File Added: mtype.patch                      
01-01-07 17:27 nazgul         Note Added: 0001598                          
======================================================================




More information about the bugs mailing list