|
|
|
[
Permlink
| « Hide
]
Vladimir Reshetnikov - 31 Jan 08 13:24
The compiler does not strictly comply with the standard here.
class B
{
public static bool operator *(Action<int> x, B y)
{
return true;
}
public static void Main()
{
Foo(x => { } * new B());
}
static void Foo(bool x) { }
}
Though it isn't mentioned in standard, lambda with "{}" block seems to have primary expression priority
This is not true, when the lambda is an operand of a cast operator, or a right oeprand of a binary operator:
var x = (Action<int>) x => {}; // error CS1525: Invalid expression term '=>' Pending issue till fixes either in C# specs either in c# compiler
It seems, that it is better to parse lambda with statement block as primary expression for now. Further validation can be done later, when the rules become apparent.
|
|||||||||||||||||||||||||||||||||||||||||||||||