Simon Hengel | 15 Aug 09:15

Bug: Generic Function that returns a Delegate from \-Expression

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)
(Continue reading)

Jb Evain | 18 Aug 17:59
Favicon

Re: Bug: Generic Function that returns a Delegate from \-Expression

Hey,

On 8/15/08, Simon Hengel <simon.hengel <at> web.de> wrote:
>  I experienced a bug with mono 1.9.1 x64/Linux. Compilation fails (it works
> with MS csc 3.5.21022.8).

Compilation still fails with another error for svn head, could you
please file a bug?

Thanks!

--

-- 
Jb Evain  <jb <at> nurv.fr>
Miguel de Icaza | 20 Aug 22:24
Favicon

Re: Bug: Generic Function that returns a Delegate from \-Expression

Hello Simon,

     Thanks for the report, could you please file the bug report in:

	www.mono-project.com/Bugs

     I tried it with Mono 2.0, and got a different error:

Unhandled Exception: System.Exception: Trying to emit a local from a
different ILGenerator.
  at System.Reflection.Emit.ILGenerator.Emit (OpCode opcode,
System.Reflection.Emit.LocalBuilder local) [0x00000] 
  at Mono.CSharp.LocalTemporary.Emit (Mono.CSharp.EmitContext ec)
[0x00000] 
  at Mono.CSharp.FieldExpr.EmitAssign (Mono.CSharp.EmitContext ec,
Mono.CSharp.Expression source, Boolean leave_copy, Boolean
prepare_for_load) [0x00000] 
  at Mono.CSharp.Assign.Emit (Mono.CSharp.EmitContext ec, Boolean
is_statement) [0x00000] 
  at Mono.CSharp.Assign.EmitStatement (Mono.CSharp.EmitContext ec)
[0x00000] 
  at Mono.CSharp.AnonymousMethodStorey.EmitHoistedFieldsInitialization
(Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.AnonymousMethodStorey.EmitHoistedVariables
(Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec)
[0x00000] 
  at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec)
[0x00000] 
  at Mono.CSharp.EmitContext.EmitResolvedTopBlock
(Continue reading)

Simon Hengel | 20 Aug 22:38

Re: Bug: Generic Function that returns a Delegate from \-Expression

>      Thanks for the report, could you please file the bug report in:

Jb Evain already did it;)

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

Gmane