Closed
Description
This code:
class A {}
void main() {
var x = new A();
switch (x.runtimeType) {
case A: print("hello");
}
}
Is accepted by the analyzer, and runs on the VM and DDC with no errors. Dart2js rejects it with the following error:
leafp-macbookpro:sdk leafp$ rundart.sh dart2js -o test.js ~/tmp/test.dart
../../../tmp/test.dart:6:10:
Error: 'case' expression type 'TypeImpl' overrides 'operator =='.
case A: print("hello");
^
Error: Compilation failed.
Is this valid code and dart2js is buggy here, or is this invalid code that should be rejected statically or dynamically?
Metadata
Metadata
Assignees
Labels
No labels