Ban this:: in is/as
commitedb1edea5bfa9c9fec0a00492d32cd15850e9d3b
authorVassil Mladenov <vmladenov@fb.com>
Thu, 7 Feb 2019 21:37:21 +0000 (7 13:37 -0800)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Thu, 7 Feb 2019 21:54:33 +0000 (7 13:54 -0800)
treef0b0aebe575976177190a953b9c59c92f8b4d76c
parent8f859ade8516b65b59b35c5b15126df59fa5b835
Ban this:: in is/as

Summary:
It is possible to hide generics from Type_test_hint_check with late static bound type constants.

```
class A {}
class B<T> {}

abstract class X {
  abstract type const T as A;
  public function f(): void {
    $a = new B<int>();
    if ($a is this::T) {}
  }
}
class Y extends X {
  const type T = B<int>;
}
```

Until type constants can be annotated with `<<__Enforceable>>`, the type checker will ban all usages of `this::T` in is/as expressions.

Reviewed By: oulgen

Differential Revision: D13951532

fbshipit-source-id: db379e13b77b9474cd4513d1f53ee67dcdaa09bf
hphp/hack/src/typing/tast_check/type_test_hint_check.ml
hphp/hack/test/typecheck/as_expression/tconst7.php.exp
hphp/hack/test/typecheck/is_expression/invalid_lsb_type_const.php [new file with mode: 0644]
hphp/hack/test/typecheck/is_expression/invalid_lsb_type_const.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/is_expression/tconst.php.exp
hphp/hack/test/typecheck/is_expression/tconst3.php.exp
hphp/hack/test/typecheck/is_expression/tconst7.php.exp