-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add type checking for explicit type arguments in new/call
Summary: In the previous diff, I added support for parsing call and new expressions with explicit type arguments, e.g., `f<T>(x)`. This diff continues that work by adding support to the type system. During the AST pass, the type arguments are converted from annotations into types and stored along with the value arguments inside a CallT and a ConstructorT use. Currently, when calling a polymorphic function or instantiating a polymorphic class, the type parameters are implicitly instantiated and their types are inferred. Using the type arguments, we can instantiate a polymorphic type explicitly, which gives developers a way to constrain the types. This capability is also very useful for adding annotations for exports. For example, if I export a `new Map()` instance, the implicit instantiations become missing annotation errors. With this feature, it becomes possible to export `new Map<K,V>()` instead. Fixes #926 Fixes #2630 Reviewed By: avikchaudhuri Differential Revision: D7657630 fbshipit-source-id: b829db79d3503e40990f0fb1cf145303457e5aa9
- Loading branch information
1 parent
40fbcdd
commit 73145b2
Showing
15 changed files
with
903 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.