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

Unified Diff: pkg/front_end/testcases/inference/map_literals_top_level.dart

Issue 2846103002: Generated front_end/testcases/inference test files from Analyzer tests. (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/testcases/inference/map_literals_top_level.dart
diff --git a/pkg/front_end/testcases/inference/map_literals_top_level.dart b/pkg/front_end/testcases/inference/map_literals_top_level.dart
new file mode 100644
index 0000000000000000000000000000000000000000..f055c9f5a3cc9210669ecaafcb841ca3d4a6b8a0
--- /dev/null
+++ b/pkg/front_end/testcases/inference/map_literals_top_level.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*@testedFeatures=inference*/
+library test;
+
+var /*@topType=Map<int, String>*/ x1 = /*@typeArgs=int, String*/ {
+ 1: 'x',
+ 2: 'y'
+};
+test1() {
+ x1[3] = 'z';
+ x1[/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
+ x1[/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 4.0] = 'u';
+ x1[3] = /*error:INVALID_ASSIGNMENT*/ 42;
+ Map<num, String> y = x1;
+}
+
+var /*@topType=Map<num, Pattern>*/ x2 = /*@typeArgs=num, Pattern*/ {
+ 1: 'x',
+ 2: 'y',
+ 3.0: new RegExp('.')
+};
+test2() {
+ x2[3] = 'z';
+ x2[/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
+ x2[4.0] = 'u';
+ x2[3] = /*error:INVALID_ASSIGNMENT*/ 42;
+ Pattern p = null;
+ x2[2] = /*@promotedType=none*/ p;
+ Map<int, String> y = /*info:ASSIGNMENT_CAST*/ x2;
+}

Powered by Google App Engine
This is Rietveld 408576698