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

Side by Side Diff: pkg/front_end/testcases/inference/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 test1() {
9 var /*@type=Map<int, String>*/ x = /*@typeArgs=int, String*/ {1: 'x', 2: 'y'};
10 /*@promotedType=none*/ x[3] = 'z';
11 /*@promotedType=none*/ x[/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
12 /*@promotedType=none*/ x[/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 4.0] = 'u';
13 /*@promotedType=none*/ x[3] = /*error:INVALID_ASSIGNMENT*/ 42;
14 Map<num, String> y = /*@promotedType=none*/ x;
15 }
16
17 test2() {
18 var /*@type=Map<num, Pattern>*/ x = /*@typeArgs=num, Pattern*/ {
19 1: 'x',
20 2: 'y',
21 3.0: new RegExp('.')
22 };
23 /*@promotedType=none*/ x[3] = 'z';
24 /*@promotedType=none*/ x[/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
25 /*@promotedType=none*/ x[4.0] = 'u';
26 /*@promotedType=none*/ x[3] = /*error:INVALID_ASSIGNMENT*/ 42;
27 Pattern p = null;
28 /*@promotedType=none*/ x[2] = /*@promotedType=none*/ p;
29 Map<int, String> y = /*info:ASSIGNMENT_CAST*/ /*@promotedType=none*/ x;
30 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698