rsdn/nemerle — Issue #140: [c# support] implicit casting from lambda expression to deletegate
Author: zyhong
Created: 2011-10-21 04:04:44+00:00
State: open

The following code compiled fine in cs compiler:
public class Class1
{
public Class1(Action t)
{
}
}

public class Class2
{
void Test()
{
var c = new Class1(a => a = a + 1);
}
}

got hese 2 errors in ncc:
..\C.cs(24,42): error : needed a writable location for assignment target, got a reference to local symbol `a function parameter a', which is read-only
..\C.cs(24,37): error : in argument #1 (t), needed a System.Action[int], got int -> int-: int -> int- is not a subtype of System.Action[int] [simple require]

any workaround for this?