forked from facebook/hhvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closures of an uninstantiable class should not be instantiable in HHB…
…BC (v2) Summary: If a class is uninstantiable, then any closures within the class should also be uninstantiable. Unfortunately we weren't getting the logic right, leading to conditions where we could assert. Fix this by detecting it in the FlattenJob, where it belongs. The first attempt failed because there's some situations where a closure may end up on a different shard than it's context class, and thus never realize the context class is uninstantiable. Reviewed By: mdko Differential Revision: D51235728 fbshipit-source-id: f96c238b8e07db6a6ae24127a778759dfbe1b32c
1 parent
a282e9c
commit 09f6283
Showing
3 changed files
with
65 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?hh | ||
|
||
function bar($c) { return $c(1); } | ||
|
||
class A {} | ||
|
||
enum class B : int extends A { | ||
int FOO = bar($x ==> $x + 1); | ||
} | ||
|
||
<<__EntryPoint>> | ||
function main() { | ||
var_dump(B::FOO); | ||
} |
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 @@ | ||
Fatal error: B cannot include A - it is not an enum class in %s/uninstantiable-closure2.php on line 7 |