You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all this is a checked mode test, but it will also fail in unchecked mode due to the following construct:
try {
var m = const <String, int>{"a": 0};
m[2] = 1; // 2 is not a String.
} on TypeError catch (error) {
result += 100000;
}
Also the static warnings differ from the analyzer:
tests/language/map_literal4_test.dart:14:37: Warning: "int" is not assignable to "String".
var m = <String, String>{"a": 0}; // 0 is not a String.
^
tests/language/map_literal4_test.dart:25:32: Warning: "String" is not assignable to "T".
var m = <String, T>{"a": "b"}; // "b" is not an int.
^^^
tests/language/map_literal4_test.dart:30:32: Warning: "int" is not assignable to "T".
var m = <String, T>{"a": 0}; // OK.
^
tests/language/map_literal4_test.dart:35:32: Warning: "int" is not assignable to "T".
var m = <String, T>{"a": 0};
^
vs
[warning] The element type 'int' cannot be assigned to the map value type 'String' (/usr/local/prj/dart/git/dart/tests/language/map_literal4_test.dart, line 14, col 37)
1 warning found.
This test should probably be rewritten to a multi-test.
The text was updated successfully, but these errors were encountered:
First of all this is a checked mode test, but it will also fail in unchecked mode due to the following construct:
try {
var m = const <String, int>{"a": 0};
m[2] = 1; // 2 is not a String.
} on TypeError catch (error) {
result += 100000;
}
Also the static warnings differ from the analyzer:
tests/language/map_literal4_test.dart:14:37: Warning: "int" is not assignable to "String".
var m = <String, String>{"a": 0}; // 0 is not a String.
^
tests/language/map_literal4_test.dart:25:32: Warning: "String" is not assignable to "T".
var m = <String, T>{"a": "b"}; // "b" is not an int.
^^^
tests/language/map_literal4_test.dart:30:32: Warning: "int" is not assignable to "T".
var m = <String, T>{"a": 0}; // OK.
^
tests/language/map_literal4_test.dart:35:32: Warning: "int" is not assignable to "T".
var m = <String, T>{"a": 0};
^
vs
[warning] The element type 'int' cannot be assigned to the map value type 'String' (/usr/local/prj/dart/git/dart/tests/language/map_literal4_test.dart, line 14, col 37)
1 warning found.
This test should probably be rewritten to a multi-test.
The text was updated successfully, but these errors were encountered: