15 Aug 09:15
Bug: Generic Function that returns a Delegate from \-Expression
From: Simon Hengel <simon.hengel <at> web.de>
Subject: Bug: Generic Function that returns a Delegate from \-Expression
Newsgroups: gmane.comp.gnome.mono.devel
Date: 2008-08-15 07:19:06 GMT
Subject: Bug: Generic Function that returns a Delegate from \-Expression
Newsgroups: gmane.comp.gnome.mono.devel
Date: 2008-08-15 07:19:06 GMT
Hello List, I experienced a bug with mono 1.9.1 x64/Linux. Compilation fails (it works with MS csc 3.5.21022.8). Source and gmcs output is attached. $ ./gmcs --version Mono C# compiler version 1.9.1.0 $ gcc --version gcc (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7) Regards, Simon Hengel
using System;
using System.Linq;
using System.Collections.Generic;
static class CurryBug
{ // curry for function of arity 3
//
// this compiles
public static Func<int,Func<int, Func<int,int>>>
curry_for_int_func (this Func<int,int,int,int> f)
{
return arg1 => arg2 => arg3 => f(arg1 , arg2 , arg3);
}
// but his does not
static Func<A,Func<B,Func<C,D>>> curry<A,B,C,D> (this Func<A,B,C,D> f)
{
return arg1 => arg2 => arg3 => f(arg1, arg2, arg3);
}
static void Main ()
{
Func<int,int,int,int> plus = (x, y, z) => x + y + z;
Console.WriteLine(plus.curry()(7)(23)(47));
}
}
Internal compiler error at curry_bug.cs(16,42):: exception caught while emitting MethodBuilder [CurryBug::curry] Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object at Mono.CSharp.ConstructedType..ctor (System.Type t, Mono.CSharp.TypeParameter[] type_params, Location l) [0x00000] at Mono.CSharp.TypeContainer.DoResolveType () [0x00000] at Mono.CSharp.TypeContainer.ResolveType () [0x00000] at Mono.CSharp.TypeContainer.ResolveType () [0x00000] at Mono.CSharp.RootScopeInfo.LinkScopes () [0x00000] at Mono.CSharp.ToplevelBlock.CompleteContexts (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] at Mono.CSharp.EmitContext.EmitTopBlock (IMethodData md, Mono.CSharp.ToplevelBlock block) [0x00000] at Mono.CSharp.MethodData.Emit (Mono.CSharp.DeclSpace parent) [0x00000] at Mono.CSharp.Method.Emit () [0x00000]
_______________________________________________ Mono-devel-list mailing list Mono-devel-list <at> lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
RSS Feed