Closed
Description
The following source code compiles and runs without error on the VM:
import "package:expect/expect.dart";
main() {
const m = const { dynamic: 1, int: 2 };
Expect.equals(1, m[dynamic]);
Expect.equals(2, m[int]);
}
But with dart2js it produces the compile-time error "Const-map key type 'TypeImpl' overrides 'operator =='."
I believe the VM behavior is correct. Since the definition of the class "Type" in the SDK is:
abstract class Type {}
it is reasonable for the user to expect that they can use Type objects as keys in constant maps.