| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 AsserterBuilder<List<Asserter<DartType>>, InterfaceType> _isFutureOf; | 48 AsserterBuilder<List<Asserter<DartType>>, InterfaceType> _isFutureOf; |
| 49 AsserterBuilderBuilder<Asserter<DartType>, List<Asserter<DartType>>, DartType> | 49 AsserterBuilderBuilder<Asserter<DartType>, List<Asserter<DartType>>, DartType> |
| 50 _isInstantiationOf; | 50 _isInstantiationOf; |
| 51 AsserterBuilder<Asserter<DartType>, InterfaceType> _isListOf; | 51 AsserterBuilder<Asserter<DartType>, InterfaceType> _isListOf; |
| 52 AsserterBuilder2<Asserter<DartType>, Asserter<DartType>, InterfaceType> | 52 AsserterBuilder2<Asserter<DartType>, Asserter<DartType>, InterfaceType> |
| 53 _isMapOf; | 53 _isMapOf; |
| 54 AsserterBuilder<List<Asserter<DartType>>, InterfaceType> _isStreamOf; | 54 AsserterBuilder<List<Asserter<DartType>>, InterfaceType> _isStreamOf; |
| 55 AsserterBuilder<DartType, DartType> _isType; | 55 AsserterBuilder<DartType, DartType> _isType; |
| 56 | 56 |
| 57 AsserterBuilder<Element, DartType> _hasElement; | 57 AsserterBuilder<Element, DartType> _hasElement; |
| 58 AsserterBuilder<DartType, DartType> _sameElement; | 58 AsserterBuilder<DartType, DartType> _hasElementOf; |
| 59 | 59 |
| 60 @override | 60 @override |
| 61 void setUp() { | 61 void setUp() { |
| 62 super.setUp(); | 62 super.setUp(); |
| 63 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | 63 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 64 options.strongMode = true; | 64 options.strongMode = true; |
| 65 resetWithOptions(options); | 65 resetWithOptions(options); |
| 66 _assertions = new TypeAssertions(typeProvider); | 66 _assertions = new TypeAssertions(typeProvider); |
| 67 _isType = _assertions.isType; | 67 _isType = _assertions.isType; |
| 68 _hasElement = _assertions.hasElement; | 68 _hasElement = _assertions.hasElement; |
| 69 _isInstantiationOf = _assertions.isInstantiationOf; | 69 _isInstantiationOf = _assertions.isInstantiationOf; |
| 70 _isInt = _assertions.isInt; | 70 _isInt = _assertions.isInt; |
| 71 _isNum = _assertions.isNum; | 71 _isNum = _assertions.isNum; |
| 72 _isString = _assertions.isString; | 72 _isString = _assertions.isString; |
| 73 _isDynamic = _assertions.isDynamic; | 73 _isDynamic = _assertions.isDynamic; |
| 74 _isListOf = _assertions.isListOf; | 74 _isListOf = _assertions.isListOf; |
| 75 _isMapOf = _assertions.isMapOf; | 75 _isMapOf = _assertions.isMapOf; |
| 76 _isFunction2Of = _assertions.isFunction2Of; | 76 _isFunction2Of = _assertions.isFunction2Of; |
| 77 _sameElement = _assertions.sameElement; | 77 _hasElementOf = _assertions.hasElementOf; |
| 78 _isFutureOf = _isInstantiationOf(_sameElement(typeProvider.futureType)); | 78 _isFutureOf = _isInstantiationOf(_hasElementOf(typeProvider.futureType)); |
| 79 _isFutureOfDynamic = _isFutureOf([_isDynamic]); | 79 _isFutureOfDynamic = _isFutureOf([_isDynamic]); |
| 80 _isFutureOfInt = _isFutureOf([_isInt]); | 80 _isFutureOfInt = _isFutureOf([_isInt]); |
| 81 _isStreamOf = _isInstantiationOf(_sameElement(typeProvider.streamType)); | 81 _isStreamOf = _isInstantiationOf(_hasElementOf(typeProvider.streamType)); |
| 82 } | 82 } |
| 83 | 83 |
| 84 test_async_method_propagation() async { | 84 test_async_method_propagation() async { |
| 85 String code = r''' | 85 String code = r''' |
| 86 import "dart:async"; | 86 import "dart:async"; |
| 87 class A { | 87 class A { |
| 88 Future f0() => new Future.value(3); | 88 Future f0() => new Future.value(3); |
| 89 Future f1() async => new Future.value(3); | 89 Future f1() async => new Future.value(3); |
| 90 Future f2() async => await new Future.value(3); | 90 Future f2() async => await new Future.value(3); |
| 91 | 91 |
| (...skipping 2328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2420 await assertTypeOfMarkedExpression(code, typeProvider.intType, null); | 2420 await assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| 2421 } | 2421 } |
| 2422 } | 2422 } |
| 2423 | 2423 |
| 2424 @reflectiveTest | 2424 @reflectiveTest |
| 2425 class StrongModeTypePropagationTest_Driver | 2425 class StrongModeTypePropagationTest_Driver |
| 2426 extends StrongModeTypePropagationTest { | 2426 extends StrongModeTypePropagationTest { |
| 2427 @override | 2427 @override |
| 2428 bool get enableNewAnalysisDriver => true; | 2428 bool get enableNewAnalysisDriver => true; |
| 2429 } | 2429 } |
| OLD | NEW |