Making sure normal enums and enum classes are distinct
commit2aedec6ef012824b58aa7d9086d418015bd9fe02
authorVincent Siles <vsiles@fb.com>
Tue, 5 Jan 2021 07:57:00 +0000 (4 23:57 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 5 Jan 2021 07:58:50 +0000 (4 23:58 -0800)
tree35bf23d3a34008838453ac0e8bf04e0d8ab79a0b
parentaf75b21e18aa39fa02d7fad12b7fe19aff63f405
Making sure normal enums and enum classes are distinct

Summary:
With enum classes reaching candidate phase, we decided that switching on them
will be up to the developper (by using an explicit `EnumMember` wrapper class).
With the upcoming "wrapper less" syntax, switch on an enum class will be like switching on an instance, not an enum.
To achieve the same behavior, developers will have to explicitly use the `EnumMember` class to wrapper their own.

Because `enum` and `enum classes` have different semantic, I want to make sure we never confuse one for the other in the typechecker.
This diff makes sure `enum class E` won't be considered as a normal `enum`

Reviewed By: francesco-zappa-nardelli

Differential Revision: D25755050

fbshipit-source-id: 178dd8bf614cdc4daae8c6c873fd53e674f2919b
hphp/hack/src/typing/typing_env.ml