Chromium Code Reviews| 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 11457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11468 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 11468 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 11469 } | 11469 } |
| 11470 | 11470 |
| 11471 void test_forEach() { | 11471 void test_forEach() { |
| 11472 Source source = addSource(r''' | 11472 Source source = addSource(r''' |
| 11473 int f(List<int> list) { | 11473 int f(List<int> list) { |
| 11474 num sum = 0; | 11474 num sum = 0; |
| 11475 for (num n in list) { | 11475 for (num n in list) { |
| 11476 sum += n & 0x0F; | 11476 sum += n & 0x0F; |
| 11477 } | 11477 } |
| 11478 return sum; | |
|
Brian Wilkerson
2015/06/09 16:25:57
Why didn't we get the hint in the old code base?
scheglov
2015/06/09 17:23:59
Good question.
That's because we compute hints alw
| |
| 11478 }'''); | 11479 }'''); |
| 11479 resolve(source); | 11480 resolve(source); |
| 11480 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 11481 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 11481 } | 11482 } |
| 11482 | 11483 |
| 11483 void test_if_and_is() { | 11484 void test_if_and_is() { |
| 11484 Source source = addSource(r''' | 11485 Source source = addSource(r''' |
| 11485 int f(num n) { | 11486 int f(num n) { |
| 11486 if (n is int && n > 0) { | 11487 if (n is int && n > 0) { |
| 11487 return n & 0x0F; | 11488 return n & 0x0F; |
| (...skipping 2387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13875 // check propagated type | 13876 // check propagated type |
| 13876 FunctionType propagatedType = node.propagatedType as FunctionType; | 13877 FunctionType propagatedType = node.propagatedType as FunctionType; |
| 13877 expect(propagatedType.returnType, test.typeProvider.stringType); | 13878 expect(propagatedType.returnType, test.typeProvider.stringType); |
| 13878 } on AnalysisException catch (e, stackTrace) { | 13879 } on AnalysisException catch (e, stackTrace) { |
| 13879 thrownException[0] = new CaughtException(e, stackTrace); | 13880 thrownException[0] = new CaughtException(e, stackTrace); |
| 13880 } | 13881 } |
| 13881 } | 13882 } |
| 13882 return null; | 13883 return null; |
| 13883 } | 13884 } |
| 13884 } | 13885 } |
| OLD | NEW |