[nem-bug] [Nemerle 0001023]: Type parameter constrants are not checked correctly

feedback at nemerle.org feedback at nemerle.org
Wed Jun 6 09:20:15 CEST 2007


The following issue has been SUBMITTED.
======================================================================
<http://nemerle.org/bugs/view.php?id=1023> 
======================================================================
Reported By:                nikov
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   1023
Category:                   Compiler (type engine)
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             06-06-2007 09:20 CEST
Last Modified:              06-06-2007 09:20 CEST
======================================================================
Summary:                    Type parameter constrants are not checked correctly
Description: 
[nemerle]
abstract class Base[T]
{
    public abstract Foo[S](obj : S) : void where S : T;
}

class Derived : Base[int?]
{
    public override Foo[S](obj : S) : void
    {
        Bar(obj);
    }

    static Bar[T](obj : T) : void where T : struct
    {
        
    }

    static Main() : void
    {
        Derived().Foo.[int?](1);
    }
}
[/nemerle]

This code compiles, but when it runs, JIT-compilation of Derived.Foo[S]
throws VerificationException. Obviously, nullable type int? does not match
'struct' constraint.
======================================================================

Issue History
Date Modified  Username       Field                    Change              
======================================================================
06-06-07 09:20 nikov          New Issue                                    
======================================================================




More information about the bugs mailing list