Synthesize concrete type constants from defaults, fix naming
commit2815d6b9781ce2f4b01d4d50719b2520e4c90243
authorVassil Mladenov <vmladenov@fb.com>
Tue, 30 Apr 2019 04:33:45 +0000 (29 21:33 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Tue, 30 Apr 2019 04:37:39 +0000 (29 21:37 -0700)
treee4e8ec948ea39823fd2a6481d0adbb845387c286
parent2f195ebbecacbd6698fb1f5e26b8c245f25df2bf
Synthesize concrete type constants from defaults, fix naming

Summary:
This implements the default behavior of abstract type constants.
```
abstract class A {
  abstract const type T = int;
}
class B extends A {
  // const type T = int; (implicit) <<<<<<
}
class C extends A {
  const type T = string; // normal behavior
}
```
I fixed the naming of the default (before, class A was being named as "A" rather than "\\A") and changed the `ttc_type` to match the `None` of abstract type constants without defaults.

This diff only implements legacy decl of type consts. Doesn't touch class consts or lazy decl.

Reviewed By: Matt-Schellhas

Differential Revision: D14967542

fbshipit-source-id: 9a4c5868c7e8628544ce769727918787ccbc66ae
25 files changed:
hphp/hack/src/annotated_ast/ast_to_aast.ml
hphp/hack/src/decl/decl.ml
hphp/hack/src/decl/decl_instantiate.ml
hphp/hack/src/naming/naming.ml
hphp/hack/test/tast/typeconsts.php.exp
hphp/hack/test/typecheck/abstract_typeconsts/HH_FLAGS [new file with mode: 0644]
hphp/hack/test/typecheck/abstract_typeconsts/basic.php [new file with mode: 0644]
hphp/hack/test/typecheck/abstract_typeconsts/basic.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/abstract_typeconsts/basic.php.legacy.exp [new file with mode: 0644]
hphp/hack/test/typecheck/abstract_typeconsts/basic.php.legacy_decl.exp [new file with mode: 0644]
hphp/hack/test/typecheck/abstract_typeconsts/change_type.php [new file with mode: 0644]
hphp/hack/test/typecheck/abstract_typeconsts/change_type.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/abstract_typeconsts/change_type.php.legacy.exp [new file with mode: 0644]
hphp/hack/test/typecheck/abstract_typeconsts/change_type.php.legacy_decl.exp [new file with mode: 0644]
hphp/hack/test/typecheck/abstract_typeconsts/skip_one.php [new file with mode: 0644]
hphp/hack/test/typecheck/abstract_typeconsts/skip_one.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/abstract_typeconsts/skip_one.php.legacy.exp [new file with mode: 0644]
hphp/hack/test/typecheck/abstract_typeconsts/skip_one.php.legacy_decl.exp [new file with mode: 0644]
hphp/hack/test/typecheck/abstract_typeconsts/skip_one_change_type.php [new file with mode: 0644]
hphp/hack/test/typecheck/abstract_typeconsts/skip_one_change_type.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/abstract_typeconsts/skip_one_change_type.php.legacy.exp [new file with mode: 0644]
hphp/hack/test/typecheck/abstract_typeconsts/skip_one_change_type.php.legacy_decl.exp [new file with mode: 0644]
hphp/hack/test/typecheck/typeconsts/default_basic.php.exp
hphp/hack/test/typecheck/typeconsts/default_basic.php.legacy.exp [copied from hphp/hack/test/typecheck/typeconsts/default_basic.php.exp with 100% similarity]
hphp/hack/test/typecheck/typeconsts/default_basic.php.legacy_decl.exp [copied from hphp/hack/test/typecheck/typeconsts/default_basic.php.exp with 100% similarity]