OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // TODO(jmesserly): this file needs to be refactored, it's a port from | 5 // TODO(jmesserly): this file needs to be refactored, it's a port from |
6 // package:dev_compiler's tests | 6 // package:dev_compiler's tests |
7 library test.src.task.strong.strong_test_helper; | 7 library test.src.task.strong.strong_test_helper; |
8 | 8 |
9 import 'package:analyzer/file_system/file_system.dart'; | 9 import 'package:analyzer/file_system/file_system.dart'; |
10 import 'package:analyzer/file_system/memory_file_system.dart'; | 10 import 'package:analyzer/file_system/memory_file_system.dart'; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 for (var lib in allLibraries) { | 85 for (var lib in allLibraries) { |
86 for (var unit in lib.units) { | 86 for (var unit in lib.units) { |
87 var errors = <AnalysisError>[]; | 87 var errors = <AnalysisError>[]; |
88 collector.errors = errors; | 88 collector.errors = errors; |
89 | 89 |
90 var source = unit.source; | 90 var source = unit.source; |
91 if (source.uri.scheme == 'dart') continue; | 91 if (source.uri.scheme == 'dart') continue; |
92 | 92 |
93 var librarySource = context.getLibrariesContaining(source).single; | 93 var librarySource = context.getLibrariesContaining(source).single; |
94 var resolved = context.resolveCompilationUnit2(source, librarySource); | 94 var resolved = context.resolveCompilationUnit2(source, librarySource); |
| 95 var analyzerErrors = context |
| 96 .getErrors(source) |
| 97 .errors |
| 98 .where((error) => |
| 99 error.errorCode.name.startsWith('dev_compiler.InferredType')) |
| 100 .toList(); |
| 101 errors.addAll(analyzerErrors); |
95 checker.visitCompilationUnit(resolved); | 102 checker.visitCompilationUnit(resolved); |
96 | 103 |
97 new _ExpectedErrorVisitor(errors).validate(resolved); | 104 new _ExpectedErrorVisitor(errors).validate(resolved); |
98 } | 105 } |
99 } | 106 } |
100 }); | 107 }); |
101 } | 108 } |
102 | 109 |
103 class _ErrorCollector implements AnalysisErrorListener { | 110 class _ErrorCollector implements AnalysisErrorListener { |
104 List<AnalysisError> errors; | 111 List<AnalysisError> errors; |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 String toString(){} | 395 String toString(){} |
389 bool ==(other){} | 396 bool ==(other){} |
390 } | 397 } |
391 class Function {} | 398 class Function {} |
392 class StackTrace {} | 399 class StackTrace {} |
393 class Symbol {} | 400 class Symbol {} |
394 class Type {} | 401 class Type {} |
395 | 402 |
396 class String { | 403 class String { |
397 String operator +(String other) {} | 404 String operator +(String other) {} |
| 405 String substring(int len) {} |
398 } | 406 } |
399 class bool {} | 407 class bool {} |
400 class num { | 408 class num { |
401 num operator +(num other) {} | 409 num operator +(num other) {} |
402 } | 410 } |
403 class int extends num { | 411 class int extends num { |
404 bool operator<(num other) {} | 412 bool operator<(num other) {} |
405 int operator-() {} | 413 int operator-() {} |
406 } | 414 } |
407 class double extends num {} | 415 class double extends num {} |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 if (levelName == 'warning') return _MAGENTA_COLOR; | 499 if (levelName == 'warning') return _MAGENTA_COLOR; |
492 if (levelName == 'info') return _CYAN_COLOR; | 500 if (levelName == 'info') return _CYAN_COLOR; |
493 return null; | 501 return null; |
494 } | 502 } |
495 | 503 |
496 const String _RED_COLOR = '\u001b[31m'; | 504 const String _RED_COLOR = '\u001b[31m'; |
497 const String _MAGENTA_COLOR = '\u001b[35m'; | 505 const String _MAGENTA_COLOR = '\u001b[35m'; |
498 const String _CYAN_COLOR = '\u001b[36m'; | 506 const String _CYAN_COLOR = '\u001b[36m'; |
499 const String GREEN_COLOR = '\u001b[32m'; | 507 const String GREEN_COLOR = '\u001b[32m'; |
500 const String NO_COLOR = '\u001b[0m'; | 508 const String NO_COLOR = '\u001b[0m'; |
OLD | NEW |