[nem-bug] [Nemerle 0000641]: Compiler crash due to function to delegate conversion inside generic class

feedback at nemerle.org feedback at nemerle.org
Sat Apr 1 17:03:25 CEST 2006


The following issue has been CONFIRMED.
======================================================================
<http://nemerle.org/bugs/view.php?id=641> 
======================================================================
Reported By:                amp
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   641
Category:                   Compiler
Reproducibility:            always
Severity:                   crash
Priority:                   normal
Status:                     confirmed
======================================================================
Date Submitted:             04-01-2006 06:51 CEST
Last Modified:              04-01-2006 17:03 CEST
======================================================================
Summary:                    Compiler crash due to function to delegate
conversion inside generic class
Description: 
The compiler crashs with "System.InvalidOperationException: can only be
called in generic type" when a recursive local function in a generic class
method uses functions on an object whose type is a generic parameter. See
the attached code.

Tested with SVN on March 30, 2006 on a recent Ubuntu Dapper. 

Mono --version outputs:

Mono JIT compiler version 1.1.13.4, (C) 2002-2005 Novell, Inc and
Contributors. www.mono-project.com
        TLS:           __thread
        GC:            Included Boehm (with typed GC)
        SIGSEGV      : normal

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

----------------------------------------------------------------------
 nazgul - 04-01-06 10:02 
----------------------------------------------------------------------
It crashes also on MS.NET:

t.n:21:1:34:2: warning: matching is not exhaustive, example unmatched
value: Nil
error: internal compiler error: got ArgumentException (The specified
method cannot be dynamic or global and must be declared on a generic type
definition.
Parameter name: method)
   at System.Reflection.Emit.TypeBuilder.GetMethod(Type type, MethodInfo
method)
   at Nemerle.Compiler.ILEmitter.workaround_mono_bug(TypeBuilder type_) in
C:\cygwin\home\nazgul\nemerle\ncc\generation\ILEmitter.n:line 84
   at Nemerle.Compiler.ILEmitter..ctor(ConstructorBuilder
constructor_builder, TypeBuilder type_, Fun_header fun_header) in
C:\cygwin\home\nazgul\nemerle\ncc\generation\ILEmitter.n:line 129
   at Nemerle.Compiler.MethodBuilder._N__N_l28840_28972.apply_void() in
C:\cygwin\home\nazgul\nemerle\ncc\generation\HierarchyEmitter.n:line 730
   at Nemerle.Compiler.TypeBuilder.FinalizeType() in
C:\cygwin\home\nazgul\nemerle\ncc\hierarchy\TypeBuilder.n:line 1594
   at Nemerle.Compiler.TypeBuilder.EmitImplementation() in
C:\cygwin\home\nazgul\nemerle\ncc\generation\HierarchyEmitter.n:line 566
   at Nemerle.Compiler.TypeBuilder._N__N_l27968_27990.apply_void() in
C:\cygwin\home\nazgul\nemerle\ncc\hierarchy\TypeBuilder.n:line 508
   at Nemerle.Compiler.Solver.Enqueue(FunctionVoid action) in
C:\cygwin\home\nazgul\nemerle\ncc\typing\Solver.n:line 198
   at Nemerle.Compiler.TypesManager.EmitDecls() in
C:\cygwin\home\nazgul\nemerle\ncc\generation\HierarchyEmitter.n:line 191
   at Nemerle.Compiler.Passes.Run() in
C:\cygwin\home\nazgul\nemerle\ncc\passes.n:line 225
   at Nemerle.CommandlineCompiler.MainClass.main_with_catching() in
C:\cygwin\home\nazgul\nemerle\ncc\main.n:line 83

----------------------------------------------------------------------
 nazgul - 04-01-06 10:25 
----------------------------------------------------------------------
Not using delegate by changing Invoke to:

public Invoke(_xSource : object, _xArgs : EventArgs, _xNextHandler :
object * EventArgs -> void) : void

workarounds the problem

----------------------------------------------------------------------
 nazgul - 04-01-06 17:03 
----------------------------------------------------------------------
Simpler testcase:

using System;

public delegate TInvoke(_ : object, _ : EventArgs) : void;

class COverloadableEvent['Handler]
{
    func : object * EventArgs -> void;
    
    Run () : void {
            _ = TInvoke (func);      
    }
}

()

Issue History
Date Modified  Username       Field                    Change              
======================================================================
04-01-06 06:51 amp            New Issue                                    
04-01-06 06:51 amp            File Added: Generics1.n                      
04-01-06 10:02 nazgul         Note Added: 0001133                          
04-01-06 10:25 nazgul         Note Added: 0001135                          
04-01-06 17:03 nazgul         Note Added: 0001136                          
04-01-06 17:03 nazgul         Status                   new => confirmed    
04-01-06 17:03 nazgul         Summary                  Compiler crash due to
recursive local functions in a generic class method => Compiler crash due to
function to delegate conversion inside generic class
04-01-06 17:03 nazgul         Description Updated                          
04-01-06 17:03 nazgul         Additional Information Updated                    
======================================================================




More information about the bugs mailing list