Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: pkg/analyzer/test/src/task/strong/strong_test_helper.dart

Issue 2786993002: Convert top-level inference errors to hints (Closed)
Patch Set: Preserve the new hints Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 analyzer.test.src.task.strong.strong_test_helper; 7 library analyzer.test.src.task.strong.strong_test_helper;
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 final prefix = 'STRONG_MODE_'; 60 final prefix = 'STRONG_MODE_';
61 if (name.startsWith(prefix)) { 61 if (name.startsWith(prefix)) {
62 return name.substring(prefix.length); 62 return name.substring(prefix.length);
63 } else { 63 } else {
64 return name; 64 return name;
65 } 65 }
66 } 66 }
67 67
68 ErrorSeverity _errorSeverity( 68 ErrorSeverity _errorSeverity(
69 AnalysisOptions analysisOptions, AnalysisError error) { 69 AnalysisOptions analysisOptions, AnalysisError error) {
70 // TODO(brianwilkerson) Remove the if when top-level inference is made an
71 // error again.
72 if (error.errorCode.name.startsWith('STRONG_MODE_TOP_LEVEL_')) {
73 return ErrorSeverity.ERROR;
74 }
70 return ErrorProcessor.getProcessor(analysisOptions, error)?.severity ?? 75 return ErrorProcessor.getProcessor(analysisOptions, error)?.severity ??
71 error.errorCode.errorSeverity; 76 error.errorCode.errorSeverity;
72 } 77 }
73 78
74 void _expectErrors(AnalysisOptions analysisOptions, CompilationUnit unit, 79 void _expectErrors(AnalysisOptions analysisOptions, CompilationUnit unit,
75 List<AnalysisError> actualErrors) { 80 List<AnalysisError> actualErrors) {
76 var expectedErrors = _findExpectedErrors(unit.beginToken); 81 var expectedErrors = _findExpectedErrors(unit.beginToken);
77 82
78 // Sort both lists: by offset, then level, then name. 83 // Sort both lists: by offset, then level, then name.
79 actualErrors.sort((x, y) { 84 actualErrors.sort((x, y) {
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 @override 473 @override
469 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 474 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
470 if (uri.scheme == 'package') { 475 if (uri.scheme == 'package') {
471 return (provider.getResource( 476 return (provider.getResource(
472 provider.convertPath('/packages/' + uri.path)) as File) 477 provider.convertPath('/packages/' + uri.path)) as File)
473 .createSource(uri); 478 .createSource(uri);
474 } 479 }
475 return super.resolveAbsolute(uri, actualUri); 480 return super.resolveAbsolute(uri, actualUri);
476 } 481 }
477 } 482 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698