-
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.
Ban traits from implementing sealed interfaces
Summary: After speaking with dlreeves, we're gonna punt on allowing traits to implement sealed interfaces for now. HHVM should support it, because it models traits differently. Reviewed By: jamesjwu Differential Revision: D7863243 fbshipit-source-id: 671dc88120b10d2a75cdff3a632250caa045361f
- Loading branch information
Showing
7 changed files
with
68 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
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 // strict | ||
// Copyright 2004-present Facebook. All Rights Reserved. | ||
|
||
<<__Sealed(B::class)>> | ||
interface A {} | ||
|
||
trait T implements A {} | ||
|
||
final class B { | ||
use T; | ||
} | ||
final class C { | ||
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,4 @@ | ||
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 |
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,16 @@ | ||
<?hh // strict | ||
// Copyright 2004-present Facebook. All Rights Reserved. | ||
|
||
<<__Sealed(B::class)>> | ||
interface A {} | ||
|
||
trait T { | ||
require implements A; | ||
} | ||
|
||
final class B implements A { | ||
use T; | ||
} | ||
final class C implements 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,4 @@ | ||
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 |