-
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.
Allow non-abstract type constants from interfaces to be overriden
Summary: The runtime allows this, and it seems to be the desired behavior for now. Without this diff, HHVM could throw a static-analysis error. Reviewed By: vassilmladenov Differential Revision: D38561777 fbshipit-source-id: 10f60e60732c014fe5897afd87bc5b9e918203c0
- Loading branch information
1 parent
7c9ac8f
commit 90d7b5c
Showing
5 changed files
with
26 additions
and
5 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
2 changes: 1 addition & 1 deletion
2
hphp/test/slow/constants/trait_interface_equivalence.php.expectf
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 +1 @@ | ||
Fatal error: C cannot inherit the type constant T from T2, because it was previously inherited from I1 in %s/test/slow/constants/trait_interface_equivalence.php on line 13 | ||
Fatal error: C cannot inherit the type constant T from %rT2|C%r, because it was previously inherited from I1 in %s/test/slow/constants/trait_interface_equivalence.php on line 13 |
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 +1 @@ | ||
Fatal error: B cannot inherit the type constant T from T, because it was previously inherited from A in %s/hphp/test/slow/constants/trait_unsoundness_example.php on line 11 | ||
Fatal error: B cannot inherit the type constant T from %rT|B%r, because it was previously inherited from A in %s/hphp/test/slow/constants/trait_unsoundness_example.php on line 11 |
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,19 @@ | ||
<?hh | ||
|
||
interface I1 { | ||
abstract const type T1; | ||
} | ||
|
||
interface I2 extends I1 { | ||
const type T1 = int; | ||
} | ||
|
||
interface I3 extends I2 { | ||
const type T1 = int; | ||
} | ||
|
||
abstract class C implements I3 {} | ||
|
||
<<__EntryPoint>> function main() { | ||
var_dump(C::class); | ||
} |
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 @@ | ||
string(1) "C" |