Allow compilation of `as` constraints on concrete type constants
commit82f76f7792721ec33f4f2c37fd943836ad100633
authorVassil Mladenov <vmladenov@fb.com>
Wed, 13 Oct 2021 17:52:42 +0000 (13 10:52 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Wed, 13 Oct 2021 17:54:09 +0000 (13 10:54 -0700)
tree76561541509de0ff7bfe7e3d5190dc207af1866f
parent827c0c2544ca019ba322eacac3c5048e56c77be0
Allow compilation of `as` constraints on concrete type constants

Summary:
This re-allows `as` constraints on concrete type constants in the runtime; they just compile to plain concrete type constants. This was the original intent of {D31328780 (https://github.com/facebook/hhvm/commit/4126b29970690b64ab171ffae6468c78bd4b1180)} with the use of `Self::raise_hh_error` and a NastCheck error code instead of `raise_parsing_error`. However, per the discussion, it looks like `raise_hh_error` erroneously raises an empty parse error during compilation; task filed T103167294.

This gives us the option to re-allow `as` constraints on concrete type constants without changing the runtime once redeclarations are eliminated, since they have a valid use case of constraining shape type constants across hierarchies.

Reviewed By: kavoor

Differential Revision: D31589120

fbshipit-source-id: 57462291f41820ff87729e16129a2d436f42a58e
hphp/hack/src/parser/lowerer/lowerer.rs
hphp/test/slow/constants/trait_unsoundness_example.php [new file with mode: 0644]
hphp/test/slow/constants/trait_unsoundness_example.php.expectf [new file with mode: 0644]