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

infer local function return types #26414

Closed
nex3 opened this issue May 5, 2016 · 3 comments
Closed

infer local function return types #26414

nex3 opened this issue May 5, 2016 · 3 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@nex3
Copy link
Member

nex3 commented May 5, 2016

If I define a named function within a method body, that function's return type should be inferred. This matches the general style of relying on inference rather than explicit typing when possible in method bodies.

@nex3 nex3 added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-strong-mode type-enhancement A request for a change that isn't a bug labels May 5, 2016
@jmesserly
Copy link

jmesserly commented May 5, 2016

Hah, yeah, we had a bug about this at one point over in DDC (dart-archive/dev_compiler#35).

Inference algorithms get a lot more interesting once local functions are involved :). The C# style inference we were planning (for #25490) is not powerful enough to handle them in general, IIRC. Scala might have something that handles it. There was another interesting paper which I can't find the link to at the moment, that extended colored local inference to handle functions.

That said -- if you mainly want return types and you don't need to have parameter types be inferred, then that should make it a lot easier. We should be albe to infer the same way we infer lambda expressions.

@nex3
Copy link
Member Author

nex3 commented May 5, 2016

Yeah, I'm referring to return types here. Inferring parameters would be cool, but I don't expect it to be possible given the way inference works in the rest of the language.

@bwilkerson bwilkerson added the P2 A bug or feature request we're likely to work on label May 11, 2016
@jmesserly jmesserly changed the title Type-infer local functions infer local function return types Aug 4, 2016
@jmesserly jmesserly self-assigned this Aug 4, 2016
@jmesserly
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants