[Mono-bugs] [Bug 484868] New: Internal compiler error on generic class with # of gen. type args > 1 and a mix of non-generic and a generic method overloads.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Mar 12 13:38:09 EDT 2009


https://bugzilla.novell.com/show_bug.cgi?id=484868


           Summary: Internal compiler error on generic class with # of
                    gen. type args > 1 and a mix of non-generic and a
                    generic method overloads.
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.2.x
          Platform: x86-64
        OS/Version: openSUSE 11.1
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: aboyko41 at yahoo.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.4)
Gecko/2008103100 SUSE/3.0.4-4.7 Firefox/3.0.4

here is a sample code:

using System;

namespace CompilerErrorRepro
{
    // note: it appears the class has to have at least 2 generic type params to
fail.
    public class MyClass<T1, T2>

    {

        // this {1.1} method decl is where the internal compiler error occurs.
        // note: same error if {1.1} is removed and {1.2} uncommented:
        // {1.1}
        public T1 DoSomething(T2 data)
        {
            DoSomething(() => data);    
            return default(T1); 
        }

        // {1.2}
//        public void DoSomething(T2 data)
//        {
//            DoSomething(() => data);    
//        }


        // note: comment out either of the following two overloads 
        //             to prevent the internal compiler error
        // {2}
        public void DoSomething(Func<T2> valueExpression)
        {
        }

        //note: no internal compiler error with this:
        //             public void DoSomething(Func<T1, T2> valueExpression)
        //         but there is an error with the following:
        // {3}
        public void DoSomething<TMethodSpecific>(Func<TMethodSpecific, T2>
valueExpression)

        {

        }        

    }

}


login at linux-zald:~/Projects/BupRepro/BupRepro> gmcs -target:library MyClass.cs
Exception caught by the compiler while compiling:
   Block that caused the problem begin at: MyClass.cs(12,27):
                     Block being compiled:
[MyClass.cs(13,17):,MyClass.cs(16,17):]
System.ArgumentOutOfRangeException: Index is less than 0 or more than or equal
to the list count.
Parameter name: index
1
Internal compiler error at MyClass.cs(12,27):: exception caught while emitting
MethodBuilder [MyClass`2::DoSomething]

Unhandled Exception: System.ArgumentOutOfRangeException: Index is less than 0
or more than or equal to the list count.
Parameter name: index
1
  at System.Collections.ArrayList.ThrowNewArgumentOutOfRangeException
(System.String name, System.Object actual, System.String message) [0x00000] 
  at System.Collections.ArrayList.set_Item (Int32 index, System.Object value)
[0x00000] 
  at Mono.CSharp.TypeInferenceContext.RemoveDependentTypes
(System.Collections.ArrayList types, System.Type returnType) [0x00000] 
  at Mono.CSharp.TypeInferenceContext.FixIndependentTypeArguments
(System.Type[] methodParameters, System.Boolean& fixed_any) [0x00000] 
  at Mono.CSharp.TypeInferenceV3.InferInPhases (Mono.CSharp.EmitContext ec,
Mono.CSharp.TypeInferenceContext tic, Mono.CSharp.AParametersCollection
methodParameters) [0x00000] 
  at Mono.CSharp.TypeInferenceV3.InferMethodArguments (Mono.CSharp.EmitContext
ec, System.Reflection.MethodBase method) [0x00000] 
  at Mono.CSharp.TypeManager.InferTypeArguments (Mono.CSharp.EmitContext ec,
System.Collections.ArrayList arguments, System.Reflection.MethodBase& method)
[0x00000] 
  at Mono.CSharp.MethodGroupExpr.IsApplicable (Mono.CSharp.EmitContext ec,
System.Collections.ArrayList arguments, Int32 arg_count,
System.Reflection.MethodBase& method, System.Boolean& params_expanded_form)
[0x00000] 
  at Mono.CSharp.MethodGroupExpr.OverloadResolve (Mono.CSharp.EmitContext ec,
System.Collections.ArrayList& Arguments, Boolean may_fail, Location loc)
[0x00000] 
  at Mono.CSharp.Invocation.DoResolveOverload (Mono.CSharp.EmitContext ec)
[0x00000] 
  at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec, ResolveFlags
flags) [0x00000] 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.ExpressionStatement.ResolveStatement (Mono.CSharp.EmitContext
ec) [0x00000] 
  at Mono.CSharp.StatementExpression.Resolve (Mono.CSharp.EmitContext ec)
[0x00000] 
  at Mono.CSharp.Block.Resolve (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.ExplicitBlock.Resolve (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.EmitContext.ResolveTopBlock (Mono.CSharp.EmitContext
anonymous_method_host, Mono.CSharp.ToplevelBlock block, Mono.CSharp.Parameters
ip, IMethodData md, System.Boolean& unreachable) [0x00000]


Reproducible: Always

Steps to Reproduce:
1. 
2.
3.
Actual Results:  
Internal compiler erros

Expected Results:  
Should compile.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list