Fix enum class switch_check detection
commit484d3a824dd23441ef2f2d5a823cf32a45ab099d
authorVincent Siles <vsiles@fb.com>
Mon, 10 Jan 2022 10:40:01 +0000 (10 02:40 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Mon, 10 Jan 2022 10:41:17 +0000 (10 02:41 -0800)
tree63363f4dcc036a40325159f3b25c2e7fb3d24aa8
parent103b8b8d41bc232d0034b81f7c6b4fb4557fff6b
Fix enum class switch_check detection

Summary:
Enum class and Enum class labels have the same `Tnewtype` "pattern" and the
existing code doesn't detect enum classes correctly. This diff makes sure we
don't mix enum class members with enum class labels.

This diff also does minor improvements (correctly displaying `enum` vs `enum class` when relevant)

Reviewed By: madgen

Differential Revision: D33395957

fbshipit-source-id: c1b9fc78a87a4fcea1487c2009ab8c1647789a9a
hphp/hack/src/errors/typing_error.ml
hphp/hack/src/errors/typing_error.mli
hphp/hack/src/typing/tast_check/switch_check.ml
hphp/hack/test/enum_class/typing/switch_exhaustive.bad.php.exp
hphp/hack/test/enum_class_label/typing/switch_exhaustive.bad.php [new file with mode: 0644]
hphp/hack/test/enum_class_label/typing/switch_exhaustive.bad.php.exp [new file with mode: 0644]
hphp/hack/test/enum_class_label/typing/switch_exhaustive.good.php [new file with mode: 0644]
hphp/hack/test/enum_class_label/typing/switch_exhaustive.good.php.exp [new file with mode: 0644]