OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library analyzer.test.generated.strong_mode_test; | 5 library analyzer.test.generated.strong_mode_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 var a1 = new A.fromMap({'hello' : 3}); | 1098 var a1 = new A.fromMap({'hello' : 3}); |
1099 var a2 = new A.fromList([3]); | 1099 var a2 = new A.fromList([3]); |
1100 var a3 = new A.fromT(3); | 1100 var a3 = new A.fromT(3); |
1101 var a4 = new A.fromB(new B(3)); | 1101 var a4 = new A.fromB(new B(3)); |
1102 } | 1102 } |
1103 '''; | 1103 '''; |
1104 CompilationUnit unit = await resolveSource(code); | 1104 CompilationUnit unit = await resolveSource(code); |
1105 Element elementA = AstFinder.getClass(unit, "A").element; | 1105 Element elementA = AstFinder.getClass(unit, "A").element; |
1106 List<Statement> statements = | 1106 List<Statement> statements = |
1107 AstFinder.getStatementsInTopLevelFunction(unit, "test"); | 1107 AstFinder.getStatementsInTopLevelFunction(unit, "test"); |
1108 DartType check(int i) { | 1108 void check(int i) { |
1109 VariableDeclarationStatement stmt = statements[i]; | 1109 VariableDeclarationStatement stmt = statements[i]; |
1110 VariableDeclaration decl = stmt.variables.variables[0]; | 1110 VariableDeclaration decl = stmt.variables.variables[0]; |
1111 Expression init = decl.initializer; | 1111 Expression init = decl.initializer; |
1112 _isInstantiationOf(_hasElement(elementA))([_isInt])(init.staticType); | 1112 _isInstantiationOf(_hasElement(elementA))([_isInt])(init.staticType); |
1113 } | 1113 } |
1114 | 1114 |
1115 for (var i = 0; i < 5; i++) check(i); | 1115 for (var i = 0; i < 5; i++) check(i); |
1116 } | 1116 } |
1117 | 1117 |
1118 test_inferConstructor_unknownTypeLowerBound() async { | 1118 test_inferConstructor_unknownTypeLowerBound() async { |
(...skipping 2802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3921 var v = x; | 3921 var v = x; |
3922 v; // marker | 3922 v; // marker |
3923 } | 3923 } |
3924 int x = 3; | 3924 int x = 3; |
3925 '''; | 3925 '''; |
3926 CompilationUnit unit = await resolveSource(code); | 3926 CompilationUnit unit = await resolveSource(code); |
3927 assertPropagatedAssignedType(code, unit, typeProvider.intType, null); | 3927 assertPropagatedAssignedType(code, unit, typeProvider.intType, null); |
3928 assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null); | 3928 assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null); |
3929 } | 3929 } |
3930 } | 3930 } |
OLD | NEW |