Commit 7481994
Throw error when cannot resolve first argument's type in
Summary:
The following fatals in HHVM and is not caught by Hack.
```
<?hh
type MyCoolType = shape(
'a' => int,
...
);
<<__EntryPoint>>
function main(): void {
PHP\var_dump(type_structure(MyCoolType::class, 'TUhOh'));
}
```
This diff makes Hack throw an error when we can't properly resolve the type of the first argument to `type_structure`. Previously, we were typing the result of this to be `Tany` and not reporting an error.
We should not allow type alias's here at all in part because we cannot support the type alias resolution at HackC time and HHVM does not support resolving type aliases here.
Reviewed By: Wilfred
Differential Revision: D39483470
fbshipit-source-id: 7bced5c09f5ac0210c752774a566a70d365dce42type_structure
1 parent 7323b1c commit 7481994
File tree
10 files changed
+62
-13
lines changed- hphp/hack
- src
- errors
- typing
- test/typecheck
- inout
- type_structure
10 files changed
+62
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2058 | 2058 | | |
2059 | 2059 | | |
2060 | 2060 | | |
2061 | | - | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
2062 | 2065 | | |
2063 | 2066 | | |
2064 | 2067 | | |
| |||
3860 | 3863 | | |
3861 | 3864 | | |
3862 | 3865 | | |
3863 | | - | |
| 3866 | + | |
3864 | 3867 | | |
3865 | 3868 | | |
3866 | | - | |
3867 | | - | |
| 3869 | + | |
3868 | 3870 | | |
3869 | 3871 | | |
3870 | 3872 | | |
3871 | | - | |
3872 | | - | |
3873 | | - | |
| 3873 | + | |
| 3874 | + | |
3874 | 3875 | | |
3875 | 3876 | | |
3876 | 3877 | | |
| |||
5796 | 5797 | | |
5797 | 5798 | | |
5798 | 5799 | | |
5799 | | - | |
| 5800 | + | |
5800 | 5801 | | |
5801 | 5802 | | |
5802 | 5803 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
803 | 803 | | |
804 | 804 | | |
805 | 805 | | |
806 | | - | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
807 | 810 | | |
808 | 811 | | |
809 | 812 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6956 | 6956 | | |
6957 | 6957 | | |
6958 | 6958 | | |
| 6959 | + | |
| 6960 | + | |
| 6961 | + | |
| 6962 | + | |
| 6963 | + | |
| 6964 | + | |
| 6965 | + | |
| 6966 | + | |
| 6967 | + | |
| 6968 | + | |
6959 | 6969 | | |
6960 | 6970 | | |
6961 | 6971 | | |
6962 | | - | |
| 6972 | + | |
| 6973 | + | |
| 6974 | + | |
| 6975 | + | |
6963 | 6976 | | |
6964 | 6977 | | |
6965 | 6978 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
5 | 10 | | |
6 | 11 | | |
7 | 12 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
1 | 6 | | |
2 | 7 | | |
3 | | - | |
4 | | - | |
| 8 | + | |
| 9 | + | |
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
1 | 6 | | |
2 | 7 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments