Check type well formedness for top level function where constraints
commit372fdc4ac950efed7c2c29e138d16669a6139ce9
authorHunter Goldstein <hgoldstein@fb.com>
Thu, 24 Feb 2022 21:15:29 +0000 (24 13:15 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Thu, 24 Feb 2022 21:15:29 +0000 (24 13:15 -0800)
treee46c3babfccf780c406c290141a1652a15a07fe4
parent9c59147514273197c788f578ae2b4bb0196f2447
Check type well formedness for top level function where constraints

Summary:
We forgot to check type well formedness for top level function where constraints, e.g. code like the following would be accepted:
```
class G<T as arraykey> {}
function foobar<T>(): T where T = G<null> {
  invariant_violation('');
}
```
Specifically that `G<null>` segment ought to error, as we're violating the constraint on `T` in `G`.

Reviewed By: vassilmladenov

Differential Revision: D34408891

fbshipit-source-id: 4195f4e80efe854fe171c08c578c25e7f169df13
hphp/hack/src/typing/typing_type_wellformedness.ml
hphp/hack/test/typecheck/higher_kinded_types/where_constraints_unsupported.php.exp
hphp/hack/test/typecheck/modules/module_weird_type_locations.php [new file with mode: 0644]
hphp/hack/test/typecheck/modules/module_weird_type_locations.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/well_formed_where_constraints_on_functions.php [new file with mode: 0644]
hphp/hack/test/typecheck/well_formed_where_constraints_on_functions.php.exp [new file with mode: 0644]