relax the constraint on enum class base type
commit140f1979bda7ea92f311317a65f0213aee605bba
authorVincent Siles <vsiles@fb.com>
Mon, 16 Nov 2020 10:32:12 +0000 (16 02:32 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Mon, 16 Nov 2020 10:34:33 +0000 (16 02:34 -0800)
tree961932db1c48bab92e715f85d611274c3af46c22
parentd7819a83eead6a13b5085594f982a2a6cf929b92
relax the constraint on enum class base type

Summary:
The experimental phase of the feature lead to a few meaningful examples
where a more relax contraint made sense. Allowing things like class/interface
where all type parameters are bound, or primite types like `mixed` or `nonnull`
seems a good idea. We can still currently support these at the cost of
verbosity and extra userland wrappers, but the code starts to get quite heavy.

The new restriction can can be read as "any type where type parameters are all bound".
In practice we are a bit more strict (we refuse `dynamic`, `any`, `object`,
shapes, function types, ...).

Reviewed By: shayne-fletcher

Differential Revision: D24951137

fbshipit-source-id: 4d4f4faf5c3bdf4022097a5500f0de33b66caf76
hphp/hack/src/errors/errors.ml
hphp/hack/src/naming/naming.ml
hphp/hack/src/typing/typing_enum.ml
hphp/hack/test/enum_class/typing/typing.good.php
hphp/hack/test/enum_class/typing/typing4.bad.php
hphp/hack/test/enum_class/typing/typing4.bad.php.exp
hphp/hack/test/enum_class/typing/typing5.bad.php
hphp/hack/test/enum_class/typing/typing5.bad.php.exp
hphp/hack/test/enum_class/typing/typing7.bad.php [deleted file]
hphp/hack/test/enum_class/typing/typing7.bad.php.exp [deleted file]