Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Statically type check "generic" methods #300

Closed
vsmenon opened this issue Aug 24, 2015 · 3 comments
Closed

Statically type check "generic" methods #300

vsmenon opened this issue Aug 24, 2015 · 3 comments

Comments

@vsmenon
Copy link
Contributor

vsmenon commented Aug 24, 2015

We need to be able to statically type check methods such as Iterable.map. E.g., this should not trigger a warning:

Iterable<int> incr(Iterable<int> iter) => iter.map((int x) => x + 1);

Initially, we can annotate / whitelist methods that should be treated as generic.

See #28 for general bug on generic methods.

@vsmenon
Copy link
Contributor Author

vsmenon commented Sep 25, 2015

Note, the code in the first comment is now handled by our initial whitelist implementation, but we're not doing any inference yet. The following variant (with less typing on the closure) is still not handled:

Iterable<int> incr(Iterable<int> iter) => iter.map((x) => x + 1);

@alorenzen
Copy link

Another example of "generic" methods is Future.then, in which a Future<T>.then((T)->V) should return a Future<V>.

@jmesserly
Copy link
Contributor

Vijay fixed this a while ago (at first with a hard coded list). Support for comment-based annotations is mostly done as well.

This was referenced Jan 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

4 participants