[Mono-bugs] [Bug 457082] New: Nested Lambdas fail to compile in generic method
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sat Dec 6 21:11:29 EST 2008
https://bugzilla.novell.com/show_bug.cgi?id=457082
Summary: Nested Lambdas fail to compile in generic method
Product: Mono: Compilers
Version: 2.2.x
Platform: 64bit
OS/Version: Linux
Status: NEW
Severity: Major
Priority: P5 - None
Component: C#
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: mono at e-tobi.net
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Created an attachment (id=258464)
--> (https://bugzilla.novell.com/attachment.cgi?id=258464)
Sample Code
This simple piece of code:
namespace Foo
{
public class Foo
{
public void DoSomething<T>()
{
Action<string> action1 = aString =>
{
Action<string> action2 = anotherString =>
{
aString.Insert(0, anotherString);
};
};
}
}
}
fails to compile (gmcs from the version 2.2 branch) with:
test.cs(11,32): warning CS0219: The variable `action2' is assigned but its
value is never used
test.cs(9,28): warning CS0219: The variable `action1' is assigned but its value
is never used
Exception caught by the compiler while emitting:
Block that caused the problem begin at: test.cs(10,13):
System.NullReferenceException: Object reference not set to an instance of an
object
Internal compiler error at test.cs(9,46):: exception caught while emitting
MethodBuilder [Foo::<DoSomething>m__1]
Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object
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 (Mono.CSharp.ToplevelBlock
block, Boolean unreachable) [0x00000]
at Mono.CSharp.EmitContext.EmitTopBlock (IMethodData md,
Mono.CSharp.ToplevelBlock block) [0x00000]
--
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