| 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 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 } | 1122 } |
| 1123 test() { | 1123 test() { |
| 1124 // downwards inference pushes List<?> and in parameter position this | 1124 // downwards inference pushes List<?> and in parameter position this |
| 1125 // becomes inferred as List<Null>. | 1125 // becomes inferred as List<Null>. |
| 1126 var c = new C((items) {}); | 1126 var c = new C((items) {}); |
| 1127 } | 1127 } |
| 1128 '''); | 1128 '''); |
| 1129 CompilationUnit unit = (await computeAnalysisResult(source)).unit; | 1129 CompilationUnit unit = (await computeAnalysisResult(source)).unit; |
| 1130 assertNoErrors(source); | 1130 assertNoErrors(source); |
| 1131 verify([source]); | 1131 verify([source]); |
| 1132 DartType cType = AstFinder | 1132 DartType cType = findLocalVariable(unit, 'c').type; |
| 1133 .getTopLevelFunction(unit, "test") | |
| 1134 .element | |
| 1135 .localVariables[0] | |
| 1136 .type; | |
| 1137 Element elementC = AstFinder.getClass(unit, "C").element; | 1133 Element elementC = AstFinder.getClass(unit, "C").element; |
| 1138 | 1134 |
| 1139 _isInstantiationOf(_hasElement(elementC))([_isDynamic])(cType); | 1135 _isInstantiationOf(_hasElement(elementC))([_isDynamic])(cType); |
| 1140 } | 1136 } |
| 1141 | 1137 |
| 1142 test_inference_error_arguments() async { | 1138 test_inference_error_arguments() async { |
| 1143 Source source = addSource(r''' | 1139 Source source = addSource(r''' |
| 1144 typedef R F<T, R>(T t); | 1140 typedef R F<T, R>(T t); |
| 1145 | 1141 |
| 1146 F<T, T> g<T>(F<T, T> f) => (x) => f(f(x)); | 1142 F<T, T> g<T>(F<T, T> f) => (x) => f(f(x)); |
| (...skipping 2776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3923 var v = x; | 3919 var v = x; |
| 3924 v; // marker | 3920 v; // marker |
| 3925 } | 3921 } |
| 3926 int x = 3; | 3922 int x = 3; |
| 3927 '''; | 3923 '''; |
| 3928 CompilationUnit unit = await resolveSource(code); | 3924 CompilationUnit unit = await resolveSource(code); |
| 3929 assertPropagatedAssignedType(code, unit, typeProvider.intType, null); | 3925 assertPropagatedAssignedType(code, unit, typeProvider.intType, null); |
| 3930 assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null); | 3926 assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null); |
| 3931 } | 3927 } |
| 3932 } | 3928 } |
| OLD | NEW |