-
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.
add test case for case types which used to not terminate
Summary: It now terminates I believe Scott's recent diff D62504808, so committing as regression test Reviewed By: madgen Differential Revision: D62646799 fbshipit-source-id: 29560a02845ca3a69df2b61075cb8de84a9159ad
- Loading branch information
1 parent
96c1e28
commit b223a72
Showing
3 changed files
with
104 additions
and
28 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
13 changes: 13 additions & 0 deletions
13
hphp/hack/test/typecheck/case_type/recursive/subtyping_simple1b.php
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,13 @@ | ||
<?hh | ||
<<file: __EnableUnstableFeatures('case_types')>> | ||
|
||
case type A as A = A; | ||
|
||
function expect_A(A $_): void {} | ||
function expect_string(string $_): void {} | ||
|
||
function foo(A $a, string $s): void { | ||
expect_A($a); | ||
expect_string($a); // nok: A <: string -> A <: string -> recursing -> nok | ||
expect_A($s); // nok: string <: A -> string <: A -> recursing -> nok | ||
} |
28 changes: 28 additions & 0 deletions
28
hphp/hack/test/typecheck/case_type/recursive/subtyping_simple1b.php.exp
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,28 @@ | ||
ERROR: File "subtyping_simple1b.php", line 4, characters 11-11: | ||
Cyclic type definition (Typing[4014]) | ||
File "subtyping_simple1b.php", line 4, characters 20-20: | ||
Cyclic use is here | ||
ERROR: File "subtyping_simple1b.php", line 11, characters 17-18: | ||
Invalid argument (Typing[4110]) | ||
File "subtyping_simple1b.php", line 7, characters 24-29: | ||
Expected `string` | ||
File "subtyping_simple1b.php", line 4, characters 16-16: | ||
But got `mixed` | ||
ERROR: File "subtyping_simple1b.php", line 12, characters 12-13: | ||
Invalid argument (Typing[4110]) | ||
File "subtyping_simple1b.php", line 6, characters 19-19: | ||
Expected `A` | ||
File "subtyping_simple1b.php", line 9, characters 20-25: | ||
But got `string` | ||
ERROR: File "subtyping_simple1b.php", line 4, characters 11-11: | ||
Invalid constraint on `newtype` (Typing[4332]) | ||
File "subtyping_simple1b.php", line 4, characters 16-16: | ||
Expected `A` | ||
File "subtyping_simple1b.php", line 4, characters 20-20: | ||
But got `mixed` | ||
ERROR: File "subtyping_simple1b.php", line 4, characters 11-11: | ||
Invalid constraint on `newtype` (Typing[4332]) | ||
File "subtyping_simple1b.php", line 4, characters 16-16: | ||
Expected `A` | ||
File "subtyping_simple1b.php", line 4, characters 20-20: | ||
But got `nonnull` |