| 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 12007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12018 '''; | 12018 '''; |
| 12019 _resolveTestUnit(code); | 12019 _resolveTestUnit(code); |
| 12020 | 12020 |
| 12021 SimpleIdentifier identifier = _findIdentifier('foo'); | 12021 SimpleIdentifier identifier = _findIdentifier('foo'); |
| 12022 VariableDeclaration declaration = | 12022 VariableDeclaration declaration = |
| 12023 identifier.getAncestor((node) => node is VariableDeclaration); | 12023 identifier.getAncestor((node) => node is VariableDeclaration); |
| 12024 expect(declaration.initializer.staticType.name, 'num'); | 12024 expect(declaration.initializer.staticType.name, 'num'); |
| 12025 expect(declaration.initializer.propagatedType, isNull); | 12025 expect(declaration.initializer.propagatedType, isNull); |
| 12026 } | 12026 } |
| 12027 | 12027 |
| 12028 void test_pseudoGeneric_max_doubleInt() { |
| 12029 String code = r''' |
| 12030 import 'dart:math'; |
| 12031 main() { |
| 12032 var foo = max(1.0, 2); |
| 12033 } |
| 12034 '''; |
| 12035 _resolveTestUnit(code); |
| 12036 |
| 12037 SimpleIdentifier identifier = _findIdentifier('foo'); |
| 12038 VariableDeclaration declaration = |
| 12039 identifier.getAncestor((node) => node is VariableDeclaration); |
| 12040 expect(declaration.initializer.staticType.name, 'num'); |
| 12041 expect(declaration.initializer.propagatedType, isNull); |
| 12042 } |
| 12043 |
| 12028 void test_pseudoGeneric_then() { | 12044 void test_pseudoGeneric_then() { |
| 12029 String code = r''' | 12045 String code = r''' |
| 12030 import 'dart:async'; | 12046 import 'dart:async'; |
| 12031 String toString(int x) => x.toString(); | 12047 String toString(int x) => x.toString(); |
| 12032 main() { | 12048 main() { |
| 12033 Future<int> bar = null; | 12049 Future<int> bar = null; |
| 12034 var foo = bar.then(toString); | 12050 var foo = bar.then(toString); |
| 12035 } | 12051 } |
| 12036 '''; | 12052 '''; |
| 12037 _resolveTestUnit(code); | 12053 _resolveTestUnit(code); |
| (...skipping 2682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14720 // check propagated type | 14736 // check propagated type |
| 14721 FunctionType propagatedType = node.propagatedType as FunctionType; | 14737 FunctionType propagatedType = node.propagatedType as FunctionType; |
| 14722 expect(propagatedType.returnType, test.typeProvider.stringType); | 14738 expect(propagatedType.returnType, test.typeProvider.stringType); |
| 14723 } on AnalysisException catch (e, stackTrace) { | 14739 } on AnalysisException catch (e, stackTrace) { |
| 14724 thrownException[0] = new CaughtException(e, stackTrace); | 14740 thrownException[0] = new CaughtException(e, stackTrace); |
| 14725 } | 14741 } |
| 14726 } | 14742 } |
| 14727 return null; | 14743 return null; |
| 14728 } | 14744 } |
| 14729 } | 14745 } |
| OLD | NEW |