Typechecker support for renamed attributes
commitded64af0b82f6382bb44b313d7ec279005273ed8
authorVassil Mladenov <vmladenov@fb.com>
Wed, 4 Apr 2018 20:04:52 +0000 (4 13:04 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Wed, 4 Apr 2018 20:59:12 +0000 (4 13:59 -0700)
tree6c6bf62ac69599f2844898f33f6c98366c753203
parent34c55f679558a63f859ad4e3f820224c9626eb59
Typechecker support for renamed attributes

Summary:
This diff implements typechecker support for strongly typed attributes
```
class __Attribute__A implements HH\ClassAttribute {
  public function __construct(public int $i, public string $s, public int $j = 23);
}

<<A(1, "a")>> // correct constructor call
class C {}

<<A("x", "a")>> // "x" is a string, incompatible with int
class X {}
```

Reviewed By: jamesjwu

Differential Revision: D6854512

fbshipit-source-id: 1edadd3f2ada6729f0f9bb8aefcdcca920bfc67b
23 files changed:
hphp/hack/hhi/attributes.hhi [new file with mode: 0644]
hphp/hack/hhi/reflection.hhi
hphp/hack/src/naming/naming.ml
hphp/hack/src/naming/naming_special_names.ml
hphp/hack/src/typing/typing.ml
hphp/hack/src/typing/typing_attributes.ml [new file with mode: 0644]
hphp/hack/src/utils/errors/errors.ml
hphp/hack/src/utils/errors/errors_sig.ml
hphp/hack/test/typecheck/attributes/create_attributes.php [new file with mode: 0644]
hphp/hack/test/typecheck/attributes/create_attributes.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/attributes/reflection.php [new file with mode: 0644]
hphp/hack/test/typecheck/attributes/reflection.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/attributes/user_attr.php [new file with mode: 0644]
hphp/hack/test/typecheck/attributes/user_attr.php.exp [new file with mode: 0644]
hphp/runtime/ext/hh/ext_hh.php
hphp/runtime/ext/reflection/ext_reflection-classes.php
hphp/runtime/ext/reflection/ext_reflection_hni.php
hphp/test/quick/attributes/class_attribute.php [new file with mode: 0644]
hphp/test/quick/attributes/class_attribute.php.expectf [new file with mode: 0644]
hphp/test/quick/attributes/create_attributes.php [new file with mode: 0644]
hphp/test/quick/attributes/create_attributes.php.expectf [new file with mode: 0644]
hphp/test/quick/attributes/empty_attribute_default_arg_vs_missing.php [new file with mode: 0644]
hphp/test/quick/attributes/empty_attribute_default_arg_vs_missing.php.expect [new file with mode: 0644]