[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
Sun Nov 6 20:28:35 CET 2005


The following issue has been SUBMITTED.
======================================================================
<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:                     new
======================================================================
Date Submitted:             11-06-2005 20:28 CET
Last Modified:              11-06-2005 20:28 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);
    }
}

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

Issue History
Date Modified  Username       Field                    Change              
======================================================================
11-06-05 20:28 nazgul         New Issue                                    
======================================================================




More information about the bugs mailing list