-
-
Notifications
You must be signed in to change notification settings - Fork 609
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
Issue 3235 & 6714 - [tdpl] Improve function literal deduction #588
Conversation
FuncExp::setType should be called first, and later semantic() resolve parameter types from tded.
1. The first FuncExp::semantic() call saves scope. 2. Next FuncExp::inferType() tries to resolve parameter types. 3. And finally setType() + semantic() determine the actual type (see functionParameters).
If FuncLiteralDeclaration::tok == TOKreserved, it is lambda declaration that is not yet determined as neither function or delegate.
Bad covariant conversion from float(int,int) to double(int,int) was incorrectly allowed.
|
Whole improvement for bug 3235. |
|
If you merge this pull, please merge dlang/phobos#381 at the same time. |
Issue 3235 & 6714 - [tdpl] Improve function literal deduction
|
Why is it OK to break existing code? Was this breaking change discussed in the NG? |
|
On 12/31/2011 9:00 AM, Andrej Mitrovic wrote:
The deciding factor for me was the improvement in code performance. |
|
@WalterBright, this change was a bit fragile. |
Issue 8112 - std.algorithm.fill must accept InputRange
Issue 3235 - [tdpl] Function literals must be deduced as "function" or "delegate"
Issue 6714 - [tdpl] Type inference for parameters of function and delegate literals
Features:
Var declaration, return statement, caller (
CallExp::e1), and argument of function call.A small breaking of existing code:
Past normal function literals, not in template arguments, are can omit parameter names.
e.g.
(string, size_t){ return 1024; }But this change regards them as parameter type omission, then raises an error.
Supplemental changes of Phobos:
dlang/phobos#381