Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Make traits, interfaces, and enums unsealable
Reviewed By: DavidSnider Differential Revision: D8066088 fbshipit-source-id: 58d744839efda2d3692da385d6934600e68c33c8
- Loading branch information
Showing
12 changed files
with
48 additions
and
22 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,8 @@ | ||
<?hh // strict | ||
|
||
<<__Sealed(B::class)>> | ||
enum A: int { | ||
FOO = 1; | ||
} | ||
|
||
abstract class B {} |
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,2 @@ | ||
File "enum.php", line 4, characters 6-6: | ||
An enum cannot be sealed (Typing[4245]) |
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,4 +1,2 @@ | ||
File "interface.php", line 8, characters 11-11: | ||
You cannot extend sealed interface A (Typing[4238]) | ||
File "interface.php", line 5, characters 11-11: | ||
Declaration is here | ||
An interface cannot be sealed (Typing[4245]) |
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,4 +1,2 @@ | ||
File "interface2.php", line 8, characters 13-13: | ||
You cannot implement sealed interface A (Typing[4238]) | ||
File "interface2.php", line 5, characters 11-11: | ||
Declaration is here | ||
An interface cannot be sealed (Typing[4245]) |
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,4 +1,2 @@ | ||
File "trait.php", line 7, characters 7-7: | ||
A trait cannot implement sealed interface A. Use `require implements` instead (Typing[4238]) | ||
File "trait.php", line 5, characters 11-11: | ||
Declaration is here | ||
An interface cannot be sealed (Typing[4245]) |
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,4 +1,2 @@ | ||
File "trait2.php", line 14, characters 13-13: | ||
You cannot implement sealed interface A (Typing[4238]) | ||
File "trait2.php", line 5, characters 11-11: | ||
Declaration is here | ||
An interface cannot be sealed (Typing[4245]) |
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,8 @@ | ||
<?hh // strict | ||
|
||
<<__Sealed(A::class)>> | ||
trait T {} | ||
|
||
abstract class A { | ||
use T; | ||
} |
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,2 @@ | ||
File "trait3.php", line 4, characters 7-7: | ||
A trait cannot be sealed (Typing[4245]) |