Dont complain about TypeImpl in switch cases

As discussed earlier today: even though TypeImpl overrides ==, all other
implementations do not and most switch cases handling type literals work as
intended.

We however continue to consider this a bug that needs to be fixed in the future
by canonicalizing types in dart2js.

Change-Id: Id8b1a6a84e7bb1859398456ef70f25b7301f9fe4
Reviewed-on: https://dart-review.googlesource.com/c/80703
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Auto-Submit: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
diff --git a/pkg/compiler/lib/src/kernel/kernel_impact.dart b/pkg/compiler/lib/src/kernel/kernel_impact.dart
index 245dcc3..7aa7324 100644
--- a/pkg/compiler/lib/src/kernel/kernel_impact.dart
+++ b/pkg/compiler/lib/src/kernel/kernel_impact.dart
@@ -953,7 +953,9 @@
           } else if (type == commonElements.functionType) {
             reporter.reportErrorMessage(computeSourceSpanFromTreeNode(node),
                 MessageKind.SWITCH_CASE_FORBIDDEN, {'type': "Function"});
-          } else if (value.isObject && overridesEquals(type)) {
+          } else if (value.isObject &&
+              type != commonElements.typeLiteralType &&
+              overridesEquals(type)) {
             reporter.reportErrorMessage(
                 computeSourceSpanFromTreeNode(firstCase),
                 MessageKind.SWITCH_CASE_VALUE_OVERRIDES_EQUALS,
diff --git a/tests/compiler/dart2js_extra/dart2js_extra.status b/tests/compiler/dart2js_extra/dart2js_extra.status
index cc44ed6..2e6c022 100644
--- a/tests/compiler/dart2js_extra/dart2js_extra.status
+++ b/tests/compiler/dart2js_extra/dart2js_extra.status
@@ -60,6 +60,7 @@
 regress/4562_test/none: CompileTimeError
 round_constant_folding_test: CompileTimeError
 statements_test: Fail
+type_constant_switch_test/01: MissingCompileTimeError
 typed_locals_test: Pass, Fail
 
 [ $compiler != dart2js ]