Skip to content

Overload resolution means lamba parameter type not always inferrable #14

@EamonNerbonne

Description

@EamonNerbonne

From eamon.nerbonne on February 03, 2011 10:02:14

Calling Fizz, with Fizz as:

bool Fizz(Func<int, bool> a) { return a(42); }
bool Fizz(Func<string, bool> a) { return a("42"); }

then Fizz(x => x=="a") is ok and valid and x inferred to be of type string and the second overload picked, but Fizz(x => true) cannot infer x; one must write Fizz( (string x) => true) since x can't be inferred - unless there's only one overload, in which case, it can be inferred.

None of this is implemented; ExpressionToCode simply assumes the type of x can always be inferred. ExpressionToCode should attempt to verify whether x's type can be inferred and if not, add types to all parameters of the lambda.

Original issue: http://code.google.com/p/expressiontocode/issues/detail?id=14

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions