XSharpPublic
XSharpPublic copied to clipboard
No type inferring in an Action<T> of a generic method
AEval<T> for example do compile check the members of the inferred x type :
CLASS Foo
PROPERTY Name AS STRING AUTO
CONSTRUCTOR(cName AS STRING)
Name := cName
END CLASS
FUNCTION Start() AS VOID STRICT
LOCAL aFooArray := { Foo{"foo"}, Foo{"bar"}} AS ARRAY OF Foo
AEval(aFooArray, { x => Console.WriteLine(x:Nam) } )
Console.WriteLine("Press any key to continue...")
Console.ReadKey()
==>
error XS1061: 'Foo' does not contain a definition for 'Nam' and no accessible extension method 'Nam' accepting a first argument of type 'Foo' could be found
But intellisens does not pickup the type (so no completion in the lambda)