Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overload resolution means lamba parameter type not always inferrable #14

Open
EamonNerbonne opened this issue May 24, 2014 · 0 comments
Labels

Comments

@EamonNerbonne
Copy link
Owner

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

@EamonNerbonne EamonNerbonne self-assigned this May 24, 2014
@EamonNerbonne EamonNerbonne removed their assignment Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant