[nem-bug] [Nemerle 0000786]: MS.NET generics/nested class problem: Code Crashes Compiler

feedback at nemerle.org feedback at nemerle.org
Thu Nov 16 17:44:18 CET 2006


The following issue has been set as RELATED TO issue 0000747.
======================================================================
<http://nemerle.org/bugs/view.php?id=786> 
======================================================================
Reported By:                wolfhound
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   786
Category:                   Compiler
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     confirmed
======================================================================
Date Submitted:             11-14-2006 21:28 CET
Last Modified:              11-16-2006 17:44 CET
======================================================================
Summary:                    MS.NET generics/nested class problem: Code Crashes
Compiler
Description: 
using System.Collections.Generic;

class StateMachine[T]
{
    public class StateSet
    {
        public Add(state : State) : void
        {
        }
    }

    public class State
    {
        public Add() : void
        {
            def set = StateSet();
            set.Add(State());
        }
    }
}

======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0000747 MS.NET generics/nested class problem: C...
======================================================================

----------------------------------------------------------------------
 nazgul - 11-14-06 21:32 
----------------------------------------------------------------------
Looks like MS.NET bug, move StateSet and State classes outside generic
StateMachine class....

----------------------------------------------------------------------
 wolfhound - 11-15-06 12:38 
----------------------------------------------------------------------
But it's work:

using System.Collections.Generic;
class StateMachine<T>
{
	public class StateSet
	{
		public void Add(State state)
		{
		}
	}

	public class State
	{
		public void Add()
		{
			StateSet set = new StateSet();
			set.Add(new State());
		}
	}
}
class Program
{
	static void Main(string[] args)
	{
		new StateMachine<int>.State().Add();
	}
}

----------------------------------------------------------------------
 nazgul - 11-15-06 12:51 
----------------------------------------------------------------------
Because csc does not use Reflection Emit to compile assemblies. In more
details - it is a bug in MS.NET System.Reflection.Emit functionality. I'm
not sure if it is possible to workaround in compiler or not - we were able
to do this before in some cases.

Issue History
Date Modified  Username       Field                    Change              
======================================================================
11-14-06 21:28 wolfhound      New Issue                                    
11-14-06 21:32 nazgul         Note Added: 0001508                          
11-15-06 12:38 wolfhound      Note Added: 0001509                          
11-15-06 12:51 nazgul         Note Added: 0001510                          
11-16-06 17:44 nazgul         Status                   new => confirmed    
11-16-06 17:44 nazgul         Summary                  internal compiler error
=> MS.NET generics/nested class problem: Code Crashes Compiler
11-16-06 17:44 nazgul         Description Updated                          
11-16-06 17:44 nazgul         Relationship added       related to 0000747  
======================================================================




More information about the bugs mailing list