| 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 analyzer.test.generated.resolver_test; | 5 library analyzer.test.generated.resolver_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1237 test_forEach() async { | 1237 test_forEach() async { |
| 1238 String code = r''' | 1238 String code = r''' |
| 1239 main() { | 1239 main() { |
| 1240 var list = <String> []; | 1240 var list = <String> []; |
| 1241 for (var e in list) { | 1241 for (var e in list) { |
| 1242 e; | 1242 e; |
| 1243 } | 1243 } |
| 1244 }'''; | 1244 }'''; |
| 1245 Source source = addSource(code); | 1245 Source source = addSource(code); |
| 1246 CompilationUnit unit = await _computeResolvedUnit(source); | 1246 CompilationUnit unit = await _computeResolvedUnit(source); |
| 1247 InterfaceType stringType = typeProvider.stringType; | |
| 1248 // in the declaration | 1247 // in the declaration |
| 1249 { | 1248 { |
| 1250 SimpleIdentifier identifier = EngineTestCase.findNode( | 1249 SimpleIdentifier identifier = EngineTestCase.findNode( |
| 1251 unit, code, "e in", (node) => node is SimpleIdentifier); | 1250 unit, code, "e in", (node) => node is SimpleIdentifier); |
| 1252 expect(identifier.propagatedType, same(stringType)); | 1251 expect(identifier.propagatedType, typeProvider.stringType); |
| 1253 } | 1252 } |
| 1254 // in the loop body | 1253 // in the loop body |
| 1255 { | 1254 { |
| 1256 SimpleIdentifier identifier = EngineTestCase.findNode( | 1255 SimpleIdentifier identifier = EngineTestCase.findNode( |
| 1257 unit, code, "e;", (node) => node is SimpleIdentifier); | 1256 unit, code, "e;", (node) => node is SimpleIdentifier); |
| 1258 expect(identifier.propagatedType, same(stringType)); | 1257 expect(identifier.propagatedType, typeProvider.stringType); |
| 1259 } | 1258 } |
| 1260 } | 1259 } |
| 1261 | 1260 |
| 1262 test_forEach_async() async { | 1261 test_forEach_async() async { |
| 1263 String code = r''' | 1262 String code = r''' |
| 1264 import 'dart:async'; | 1263 import 'dart:async'; |
| 1265 f(Stream<String> stream) async { | 1264 f(Stream<String> stream) async { |
| 1266 await for (var e in stream) { | 1265 await for (var e in stream) { |
| 1267 e; | 1266 e; |
| 1268 } | 1267 } |
| 1269 }'''; | 1268 }'''; |
| 1270 Source source = addSource(code); | 1269 Source source = addSource(code); |
| 1271 CompilationUnit unit = await _computeResolvedUnit(source); | 1270 CompilationUnit unit = await _computeResolvedUnit(source); |
| 1272 InterfaceType stringType = typeProvider.stringType; | |
| 1273 // in the declaration | 1271 // in the declaration |
| 1274 { | 1272 { |
| 1275 SimpleIdentifier identifier = EngineTestCase.findNode( | 1273 SimpleIdentifier identifier = EngineTestCase.findNode( |
| 1276 unit, code, "e in", (node) => node is SimpleIdentifier); | 1274 unit, code, "e in", (node) => node is SimpleIdentifier); |
| 1277 expect(identifier.propagatedType, same(stringType)); | 1275 expect(identifier.propagatedType, typeProvider.stringType); |
| 1278 } | 1276 } |
| 1279 // in the loop body | 1277 // in the loop body |
| 1280 { | 1278 { |
| 1281 SimpleIdentifier identifier = EngineTestCase.findNode( | 1279 SimpleIdentifier identifier = EngineTestCase.findNode( |
| 1282 unit, code, "e;", (node) => node is SimpleIdentifier); | 1280 unit, code, "e;", (node) => node is SimpleIdentifier); |
| 1283 expect(identifier.propagatedType, same(stringType)); | 1281 expect(identifier.propagatedType, typeProvider.stringType); |
| 1284 } | 1282 } |
| 1285 } | 1283 } |
| 1286 | 1284 |
| 1287 test_forEach_async_inheritedStream() async { | 1285 test_forEach_async_inheritedStream() async { |
| 1288 // From https://github.com/dart-lang/sdk/issues/24191, this ensures that | 1286 // From https://github.com/dart-lang/sdk/issues/24191, this ensures that |
| 1289 // `await for` works for types where the generic parameter doesn't | 1287 // `await for` works for types where the generic parameter doesn't |
| 1290 // correspond to the type of the Stream's data. | 1288 // correspond to the type of the Stream's data. |
| 1291 String code = r''' | 1289 String code = r''' |
| 1292 import 'dart:async'; | 1290 import 'dart:async'; |
| 1293 abstract class MyCustomStream<T> implements Stream<List<T>> {} | 1291 abstract class MyCustomStream<T> implements Stream<List<T>> {} |
| (...skipping 2318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3612 */ | 3610 */ |
| 3613 class _StaleElement extends ElementImpl { | 3611 class _StaleElement extends ElementImpl { |
| 3614 _StaleElement() : super("_StaleElement", -1); | 3612 _StaleElement() : super("_StaleElement", -1); |
| 3615 | 3613 |
| 3616 @override | 3614 @override |
| 3617 get kind => throw "_StaleElement's kind shouldn't be accessed"; | 3615 get kind => throw "_StaleElement's kind shouldn't be accessed"; |
| 3618 | 3616 |
| 3619 @override | 3617 @override |
| 3620 /*=T*/ accept/*<T>*/(_) => throw "_StaleElement shouldn't be visited"; | 3618 /*=T*/ accept/*<T>*/(_) => throw "_StaleElement shouldn't be visited"; |
| 3621 } | 3619 } |
| OLD | NEW |