OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 engine.non_error_resolver_test; | 5 library engine.non_error_resolver_test; |
6 | 6 |
7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
9 import 'package:analyzer/src/generated/error.dart'; | 9 import 'package:analyzer/src/generated/error.dart'; |
10 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; | 10 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; |
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 void test_exportOfNonLibrary_libraryNotDeclared() { | 1334 void test_exportOfNonLibrary_libraryNotDeclared() { |
1335 Source source = addSource(r''' | 1335 Source source = addSource(r''' |
1336 library L; | 1336 library L; |
1337 export 'lib1.dart';'''); | 1337 export 'lib1.dart';'''); |
1338 addNamedSource("/lib1.dart", ""); | 1338 addNamedSource("/lib1.dart", ""); |
1339 resolve(source); | 1339 resolve(source); |
1340 assertNoErrors(source); | 1340 assertNoErrors(source); |
1341 verify([source]); | 1341 verify([source]); |
1342 } | 1342 } |
1343 | 1343 |
1344 void test_extraPositionalArguments_Function() { | |
1345 Source source = addSource(r''' | |
1346 f(Function a) { | |
1347 a(1, 2); | |
1348 }'''); | |
1349 resolve(source); | |
1350 assertNoErrors(source); | |
1351 verify([source]); | |
1352 } | |
1353 | |
1354 void test_extraPositionalArguments_function() { | 1344 void test_extraPositionalArguments_function() { |
1355 Source source = addSource(r''' | 1345 Source source = addSource(r''' |
1356 f(p1, p2) {} | 1346 f(p1, p2) {} |
1357 main() { | 1347 main() { |
1358 f(1, 2); | 1348 f(1, 2); |
1359 }'''); | 1349 }'''); |
1360 resolve(source); | 1350 resolve(source); |
1361 assertNoErrors(source); | 1351 assertNoErrors(source); |
| 1352 verify([source]); |
| 1353 } |
| 1354 |
| 1355 void test_extraPositionalArguments_Function() { |
| 1356 Source source = addSource(r''' |
| 1357 f(Function a) { |
| 1358 a(1, 2); |
| 1359 }'''); |
| 1360 resolve(source); |
| 1361 assertNoErrors(source); |
1362 verify([source]); | 1362 verify([source]); |
1363 } | 1363 } |
1364 | 1364 |
1365 void test_extraPositionalArguments_implicitConstructor() { | 1365 void test_extraPositionalArguments_implicitConstructor() { |
1366 Source source = addSource(r''' | 1366 Source source = addSource(r''' |
1367 class A<E extends num> { | 1367 class A<E extends num> { |
1368 A(E x, E y); | 1368 A(E x, E y); |
1369 } | 1369 } |
1370 class M {} | 1370 class M {} |
1371 class B<E extends num> = A<E> with M; | 1371 class B<E extends num> = A<E> with M; |
(...skipping 3700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5072 Source source = addSource(''' | 5072 Source source = addSource(''' |
5073 f() async* { | 5073 f() async* { |
5074 yield 3; | 5074 yield 3; |
5075 } | 5075 } |
5076 '''); | 5076 '''); |
5077 resolve(source); | 5077 resolve(source); |
5078 assertNoErrors(source); | 5078 assertNoErrors(source); |
5079 verify([source]); | 5079 verify([source]); |
5080 } | 5080 } |
5081 | 5081 |
| 5082 void test_yield_each_async_dynamic_to_dynamic() { |
| 5083 Source source = addSource(''' |
| 5084 f() async* { |
| 5085 yield* g(); |
| 5086 } |
| 5087 g() => null; |
| 5088 '''); |
| 5089 resolve(source); |
| 5090 assertNoErrors(source); |
| 5091 verify([source]); |
| 5092 } |
| 5093 |
| 5094 void test_yield_each_async_dynamic_to_stream() { |
| 5095 Source source = addSource(''' |
| 5096 import 'dart:async'; |
| 5097 Stream f() async* { |
| 5098 yield* g(); |
| 5099 } |
| 5100 g() => null; |
| 5101 '''); |
| 5102 resolve(source); |
| 5103 assertNoErrors(source); |
| 5104 verify([source]); |
| 5105 } |
| 5106 |
| 5107 void test_yield_each_async_dynamic_to_typed_stream() { |
| 5108 Source source = addSource(''' |
| 5109 import 'dart:async'; |
| 5110 Stream<int> f() async* { |
| 5111 yield* g(); |
| 5112 } |
| 5113 g() => null; |
| 5114 '''); |
| 5115 resolve(source); |
| 5116 assertNoErrors(source); |
| 5117 verify([source]); |
| 5118 } |
| 5119 |
| 5120 void test_yield_each_async_stream_to_dynamic() { |
| 5121 Source source = addSource(''' |
| 5122 import 'dart:async'; |
| 5123 f() async* { |
| 5124 yield* g(); |
| 5125 } |
| 5126 Stream g() => null; |
| 5127 '''); |
| 5128 resolve(source); |
| 5129 assertNoErrors(source); |
| 5130 verify([source]); |
| 5131 } |
| 5132 |
| 5133 void test_yield_each_async_typed_stream_to_dynamic() { |
| 5134 Source source = addSource(''' |
| 5135 import 'dart:async'; |
| 5136 f() async* { |
| 5137 yield* g(); |
| 5138 } |
| 5139 Stream<int> g() => null; |
| 5140 '''); |
| 5141 resolve(source); |
| 5142 assertNoErrors(source); |
| 5143 verify([source]); |
| 5144 } |
| 5145 |
| 5146 void test_yield_each_async_typed_stream_to_typed_stream() { |
| 5147 Source source = addSource(''' |
| 5148 import 'dart:async'; |
| 5149 Stream<int> f() async* { |
| 5150 yield* g(); |
| 5151 } |
| 5152 Stream<int> g() => null; |
| 5153 '''); |
| 5154 resolve(source); |
| 5155 assertNoErrors(source); |
| 5156 verify([source]); |
| 5157 } |
| 5158 |
| 5159 void test_yield_each_sync_dynamic_to_dynamic() { |
| 5160 Source source = addSource(''' |
| 5161 f() sync* { |
| 5162 yield* g(); |
| 5163 } |
| 5164 g() => null; |
| 5165 '''); |
| 5166 resolve(source); |
| 5167 assertNoErrors(source); |
| 5168 verify([source]); |
| 5169 } |
| 5170 |
| 5171 void test_yield_each_sync_dynamic_to_iterable() { |
| 5172 Source source = addSource(''' |
| 5173 Iterable f() sync* { |
| 5174 yield* g(); |
| 5175 } |
| 5176 g() => null; |
| 5177 '''); |
| 5178 resolve(source); |
| 5179 assertNoErrors(source); |
| 5180 verify([source]); |
| 5181 } |
| 5182 |
| 5183 void test_yield_each_sync_dynamic_to_typed_iterable() { |
| 5184 Source source = addSource(''' |
| 5185 Iterable<int> f() sync* { |
| 5186 yield* g(); |
| 5187 } |
| 5188 g() => null; |
| 5189 '''); |
| 5190 resolve(source); |
| 5191 assertNoErrors(source); |
| 5192 verify([source]); |
| 5193 } |
| 5194 |
| 5195 void test_yield_each_sync_iterable_to_dynamic() { |
| 5196 Source source = addSource(''' |
| 5197 f() sync* { |
| 5198 yield* g(); |
| 5199 } |
| 5200 Iterable g() => null; |
| 5201 '''); |
| 5202 resolve(source); |
| 5203 assertNoErrors(source); |
| 5204 verify([source]); |
| 5205 } |
| 5206 |
| 5207 void test_yield_each_sync_typed_iterable_to_dynamic() { |
| 5208 Source source = addSource(''' |
| 5209 f() sync* { |
| 5210 yield* g(); |
| 5211 } |
| 5212 Iterable<int> g() => null; |
| 5213 '''); |
| 5214 resolve(source); |
| 5215 assertNoErrors(source); |
| 5216 verify([source]); |
| 5217 } |
| 5218 |
| 5219 void test_yield_each_sync_typed_iterable_to_typed_iterable() { |
| 5220 Source source = addSource(''' |
| 5221 Iterable<int> f() sync* { |
| 5222 yield* g(); |
| 5223 } |
| 5224 Iterable<int> g() => null; |
| 5225 '''); |
| 5226 resolve(source); |
| 5227 assertNoErrors(source); |
| 5228 verify([source]); |
| 5229 } |
| 5230 |
5082 void test_yield_sync_to_dynamic_type() { | 5231 void test_yield_sync_to_dynamic_type() { |
5083 Source source = addSource(''' | 5232 Source source = addSource(''' |
5084 dynamic f() sync* { | 5233 dynamic f() sync* { |
5085 yield 3; | 5234 yield 3; |
5086 } | 5235 } |
5087 '''); | 5236 '''); |
5088 resolve(source); | 5237 resolve(source); |
5089 assertNoErrors(source); | 5238 assertNoErrors(source); |
5090 verify([source]); | 5239 verify([source]); |
5091 } | 5240 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5172 resolve(source); | 5321 resolve(source); |
5173 assertNoErrors(source); | 5322 assertNoErrors(source); |
5174 verify([source]); | 5323 verify([source]); |
5175 reset(); | 5324 reset(); |
5176 } | 5325 } |
5177 | 5326 |
5178 void _check_wrongNumberOfParametersForOperator1(String name) { | 5327 void _check_wrongNumberOfParametersForOperator1(String name) { |
5179 _check_wrongNumberOfParametersForOperator(name, "a"); | 5328 _check_wrongNumberOfParametersForOperator(name, "a"); |
5180 } | 5329 } |
5181 } | 5330 } |
OLD | NEW |