-
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.
Summary: Hack considered trait names as enforceable and allowed passing them explicitly to enforceable reified generics. This diff makes trait names non-enforceable. Reviewed By: madgen Differential Revision: D57335063 fbshipit-source-id: ca988f4c53fb5e4b67207a61cb1dbd92c3d1c03b
- Loading branch information
1 parent
0bd9816
commit 9001bd2
Showing
8 changed files
with
83 additions
and
57 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
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?hh | ||
|
||
trait FooTrait {} | ||
|
||
class C{} | ||
|
||
function foo<<<__Enforceable>> reify T>(mixed $in): void { | ||
$in as T; | ||
} | ||
|
||
function test(): void { | ||
foo<FooTrait>(42); | ||
foo<C>(42); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
ERROR: File "trait_not_enforceable.php", line 12, characters 7-14: | ||
Invalid type (Typing[4302]) | ||
File "trait_not_enforceable.php", line 7, characters 38-38: | ||
Type parameter `T` was declared `__Enforceable` here | ||
File "trait_not_enforceable.php", line 12, characters 7-14: | ||
This type is not enforceable because it has a trait name |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.