| Index: test/checker/checker_test.dart
|
| diff --git a/test/checker/checker_test.dart b/test/checker/checker_test.dart
|
| index abf647235613336ee6b2c718119726dcec8810bf..f8cb77a67bc3e2b69042130da1e7846f28b0b411 100644
|
| --- a/test/checker/checker_test.dart
|
| +++ b/test/checker/checker_test.dart
|
| @@ -1447,6 +1447,51 @@ main() {
|
| });
|
| });
|
|
|
| + test('Type checking literals', () {
|
| + testChecker({
|
| + '/main.dart': '''
|
| + test() {
|
| + num n = 3;
|
| + int i = 3;
|
| + String s = "hello";
|
| + {
|
| + List<int> l = <int>[i];
|
| + l = <int>[/*severe:StaticTypeError*/s];
|
| + l = <int>[/*info:DownCast*/n];
|
| + l = <int>[i, /*info:DownCast*/n, /*severe:StaticTypeError*/s];
|
| + }
|
| + {
|
| + List l = [i];
|
| + l = [s];
|
| + l = [n];
|
| + l = [i, n, s];
|
| + }
|
| + {
|
| + Map<String, int> m = <String, int>{s: i};
|
| + m = <String, int>{s: /*severe:StaticTypeError*/s};
|
| + m = <String, int>{s: /*info:DownCast*/n};
|
| + m = <String, int>{s: i,
|
| + s: /*info:DownCast*/n,
|
| + s: /*severe:StaticTypeError*/s};
|
| + }
|
| + // TODO(leafp): We can't currently test for key errors since the
|
| + // error marker binds to the entire entry.
|
| + {
|
| + Map m = {s: i};
|
| + m = {s: s};
|
| + m = {s: n};
|
| + m = {s: i,
|
| + s: n,
|
| + s: s};
|
| + m = {i: s,
|
| + n: s,
|
| + s: s};
|
| + }
|
| + }
|
| + '''
|
| + });
|
| + });
|
| +
|
| test('redirecting constructor', () {
|
| testChecker({
|
| '/main.dart': '''
|
|
|