[nem-bug] [Nemerle 0000727]: Problem with functions and tuples

feedback at nemerle.org feedback at nemerle.org
Sat Aug 5 15:42:56 CEST 2006


The following issue has been SUBMITTED.
======================================================================
<https://nemerle.org/bugs/view.php?id=727> 
======================================================================
Reported By:                steffen
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   727
Category:                   Compiler
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             08-05-2006 15:42 CEST
Last Modified:              08-05-2006 15:42 CEST
======================================================================
Summary:                    Problem with functions and tuples
Description: 
This program is compiled to invalid IL:


class A[T] {
    public CreateFunction() : T->void {
        fun (_) {}
    }
}

def a = A.[int*int]();

def f = a.CreateFunction();

f(1, 2);


The IL for the Main()-method is:
    // method line 3
    .method private static  hidebysig
           default void Main ()  cil managed
    {
        // Method begins at RVA 0x2108
        .entrypoint
        // Code size 22 (0x16)
        .maxstack 6
        .locals init (
                class A`1<valuetype
[Nemerle]Nemerle.Builtins.Tuple`2<int32, int32>>    V_0,
                class [Nemerle]Nemerle.Builtins.FunctionVoid`2<int32,
int32>   V_1)
        IL_0000:  newobj instance void class A`1<valuetype
[Nemerle]Nemerle.Builtins.Tuple`2<int32, int32>>::.ctor()
        IL_0005:  stloc.0
        IL_0006:  ldloc.0
        IL_0007:  callvirt instance class
[Nemerle]Nemerle.Builtins.FunctionVoid`1<!0> class A`1<valuetype
[Nemerle]Nemerle.Builtins.Tuple`2<int32, int32>>::CreateFunction()
        IL_000c:  stloc.1
        IL_000d:  ldloc.1
        IL_000e:  ldc.i4.1
        IL_000f:  ldc.i4.2
        IL_0010:  callvirt instance void class
[Nemerle]Nemerle.Builtins.FunctionVoid`2<int32, int32>::apply_void(!0,
!1)
        IL_0015:  ret
    } // end of method _N_AutoModule::default void Main ()


The problem is that here
        IL_0007:  callvirt instance class
[Nemerle]Nemerle.Builtins.FunctionVoid`1<!0> class A`1<valuetype
[Nemerle]Nemerle.Builtins.Tuple`2<int32, int32>>::CreateFunction()
        IL_000c:  stloc.1
a Nemerle.Builtins.FunctionVoid`1 is saved to a local variable with the
type Nemerle.Builtins.FunctionVoid`2. 
======================================================================

Issue History
Date Modified  Username       Field                    Change              
======================================================================
08-05-06 15:42 steffen        New Issue                                    
======================================================================




More information about the bugs mailing list