Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(593)

Side by Side Diff: pkg/front_end/testcases/inference/downwards_inference_on_map_literals.dart

Issue 2846103002: Generated front_end/testcases/inference test files from Analyzer tests. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 /*@testedFeatures=inference*/
6 library test;
7
8 void foo(
9 [Map<int, String> m1 = /*@typeArgs=int, String*/ const {1: "hello"},
10 Map<int, String> m2 = /*@typeArgs=int, String*/ const {
11 // One error is from type checking and the other is from const evaluation.
12 /*error:MAP_KEY_TYPE_NOT_ASSIGNABLE,error:MAP_KEY_TYPE_NOT_ASSIGNABLE*/ "h ello":
13 "world"
14 }]) {}
15 void main() {
16 {
17 Map<int, String> l0 = /*@typeArgs=int, String*/ {};
18 Map<int, String> l1 = /*@typeArgs=int, String*/ {3: "hello"};
19 Map<int, String> l2 = /*@typeArgs=int, String*/ {
20 /*error:MAP_KEY_TYPE_NOT_ASSIGNABLE*/ "hello": "hello"
21 };
22 Map<int, String> l3 = /*@typeArgs=int, String*/ {
23 3: /*error:MAP_VALUE_TYPE_NOT_ASSIGNABLE*/ 3
24 };
25 Map<int, String> l4 = /*@typeArgs=int, String*/ {
26 3: "hello",
27 /*error:MAP_KEY_TYPE_NOT_ASSIGNABLE*/ "hello":
28 /*error:MAP_VALUE_TYPE_NOT_ASSIGNABLE*/ 3
29 };
30 }
31 {
32 Map<dynamic, dynamic> l0 = /*@typeArgs=dynamic, dynamic*/ {};
33 Map<dynamic, dynamic> l1 = /*@typeArgs=dynamic, dynamic*/ {3: "hello"};
34 Map<dynamic, dynamic> l2 = /*@typeArgs=dynamic, dynamic*/ {
35 "hello": "hello"
36 };
37 Map<dynamic, dynamic> l3 = /*@typeArgs=dynamic, dynamic*/ {3: 3};
38 Map<dynamic, dynamic> l4 = /*@typeArgs=dynamic, dynamic*/ {
39 3: "hello",
40 "hello": 3
41 };
42 }
43 {
44 Map<dynamic, String> l0 = /*@typeArgs=dynamic, String*/ {};
45 Map<dynamic, String> l1 = /*@typeArgs=dynamic, String*/ {3: "hello"};
46 Map<dynamic, String> l2 = /*@typeArgs=dynamic, String*/ {"hello": "hello"};
47 Map<dynamic, String> l3 = /*@typeArgs=dynamic, String*/ {
48 3: /*error:MAP_VALUE_TYPE_NOT_ASSIGNABLE*/ 3
49 };
50 Map<dynamic, String> l4 = /*@typeArgs=dynamic, String*/ {
51 3: "hello",
52 "hello": /*error:MAP_VALUE_TYPE_NOT_ASSIGNABLE*/ 3
53 };
54 }
55 {
56 Map<int, dynamic> l0 = /*@typeArgs=int, dynamic*/ {};
57 Map<int, dynamic> l1 = /*@typeArgs=int, dynamic*/ {3: "hello"};
58 Map<int, dynamic> l2 = /*@typeArgs=int, dynamic*/ {
59 /*error:MAP_KEY_TYPE_NOT_ASSIGNABLE*/ "hello": "hello"
60 };
61 Map<int, dynamic> l3 = /*@typeArgs=int, dynamic*/ {3: 3};
62 Map<int, dynamic> l4 = /*@typeArgs=int, dynamic*/ {
63 3: "hello",
64 /*error:MAP_KEY_TYPE_NOT_ASSIGNABLE*/ "hello": 3
65 };
66 }
67 {
68 Map<int, String> l0 = /*error:INVALID_CAST_LITERAL_MAP*/ <num, dynamic>{};
69 Map<int, String> l1 = /*error:INVALID_CAST_LITERAL_MAP*/ <num, dynamic>{
70 3: "hello"
71 };
72 Map<int, String> l3 = /*error:INVALID_CAST_LITERAL_MAP*/ <num, dynamic>{
73 3: 3
74 };
75 }
76 {
77 const Map<int, String> l0 = /*@typeArgs=int, String*/ const {};
78 const Map<int, String> l1 = /*@typeArgs=int, String*/ const {3: "hello"};
79 const Map<int, String> l2 = /*@typeArgs=int, String*/ const {
80 /*error:MAP_KEY_TYPE_NOT_ASSIGNABLE,error:MAP_KEY_TYPE_NOT_ASSIGNABLE*/ "h ello":
81 "hello"
82 };
83 const Map<int, String> l3 = /*@typeArgs=int, String*/ const {
84 3: /*error:MAP_VALUE_TYPE_NOT_ASSIGNABLE,error:MAP_VALUE_TYPE_NOT_ASSIGNAB LE*/ 3
85 };
86 const Map<int, String> l4 = /*@typeArgs=int, String*/ const {
87 3: "hello",
88 /*error:MAP_KEY_TYPE_NOT_ASSIGNABLE,error:MAP_KEY_TYPE_NOT_ASSIGNABLE*/ "h ello":
89 /*error:MAP_VALUE_TYPE_NOT_ASSIGNABLE,error:MAP_VALUE_TYPE_NOT_ASSIGNA BLE*/ 3
90 };
91 }
92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698