-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid generating expression-dependent type when it's safe to do so
Summary: Expression-dependent types are necessary only for classes that EITHER define abstract type constants (which can be realized by distinct types in subclasses) OR have methods that make use of `this` in their signatures (because these can be realized by distinct types in subclasses). Unfortunately, there is nothing at the class level that flags this property, but for well-known built-in classes such as `vec` and `dict` we can avoid generating an expression-dependent type. Comments welcome on how we might generalize this. Reviewed By: mheiber, madgen Differential Revision: D53920324 fbshipit-source-id: e68445d1155cbc40c364faba7a0536da25e4a6f0
- Loading branch information
1 parent
80b0b84
commit 51b81f1
Showing
5 changed files
with
15 additions
and
11 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
File "simplify_unions.php", line 10, characters 3-13: | ||
(<expr#2> as vec<C> | vec<nothing>) | ||
vec<C> | ||
No errors |
2 changes: 1 addition & 1 deletion
2
hphp/hack/test/typecheck/new_inference/simplify_unions.php.imp_pess_exp
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
File "simplify_unions.php", line 10, characters 3-13: | ||
~(<expr#2> as vec<C> | vec<nothing>) | ||
~vec<C> | ||
No errors |
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