| 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.resolver_test; | 5 library engine.resolver_test; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/context/context.dart' as newContext; | 9 import 'package:analyzer/src/context/context.dart' as newContext; |
| 10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
| (...skipping 12037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12048 main() { | 12048 main() { |
| 12049 Future<int> bar = null; | 12049 Future<int> bar = null; |
| 12050 var foo = bar.then(toString); | 12050 var foo = bar.then(toString); |
| 12051 } | 12051 } |
| 12052 '''; | 12052 '''; |
| 12053 _resolveTestUnit(code); | 12053 _resolveTestUnit(code); |
| 12054 | 12054 |
| 12055 SimpleIdentifier identifier = _findIdentifier('foo'); | 12055 SimpleIdentifier identifier = _findIdentifier('foo'); |
| 12056 VariableDeclaration declaration = | 12056 VariableDeclaration declaration = |
| 12057 identifier.getAncestor((node) => node is VariableDeclaration); | 12057 identifier.getAncestor((node) => node is VariableDeclaration); |
| 12058 InterfaceType stringType = typeProvider.stringType; | |
| 12059 InterfaceType futureType = typeProvider.futureType; | |
| 12060 InterfaceType futureOfStringType = | |
| 12061 futureType.substitute4(<DartType>[stringType]); | |
| 12062 | 12058 |
| 12063 expect(declaration.initializer.staticType.toString(), "Future<String>"); | 12059 expect(declaration.initializer.staticType.toString(), "Future<String>"); |
| 12064 expect(declaration.initializer.propagatedType, isNull); | 12060 expect(declaration.initializer.propagatedType, isNull); |
| 12065 } | 12061 } |
| 12066 } | 12062 } |
| 12067 | 12063 |
| 12068 @reflectiveTest | 12064 @reflectiveTest |
| 12069 class StrongModeTypePropagationTest extends ResolverTestCase { | 12065 class StrongModeTypePropagationTest extends ResolverTestCase { |
| 12070 @override | 12066 @override |
| 12071 void setUp() { | 12067 void setUp() { |
| (...skipping 2754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14826 // check propagated type | 14822 // check propagated type |
| 14827 FunctionType propagatedType = node.propagatedType as FunctionType; | 14823 FunctionType propagatedType = node.propagatedType as FunctionType; |
| 14828 expect(propagatedType.returnType, test.typeProvider.stringType); | 14824 expect(propagatedType.returnType, test.typeProvider.stringType); |
| 14829 } on AnalysisException catch (e, stackTrace) { | 14825 } on AnalysisException catch (e, stackTrace) { |
| 14830 thrownException[0] = new CaughtException(e, stackTrace); | 14826 thrownException[0] = new CaughtException(e, stackTrace); |
| 14831 } | 14827 } |
| 14832 } | 14828 } |
| 14833 return null; | 14829 return null; |
| 14834 } | 14830 } |
| 14835 } | 14831 } |
| OLD | NEW |