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

Unified Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 2239613002: Issue 27053. Record errors in InferStaticVariableTypeTask and include them into unit errors. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/src/task/dart_test.dart
diff --git a/pkg/analyzer/test/src/task/dart_test.dart b/pkg/analyzer/test/src/task/dart_test.dart
index 83053ef4dea51a61d77d80f8beac97fb69940efd..c01223cff632f6699c954acd8493150c1a931e62 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -2999,6 +2999,26 @@ var Y = () {
InterfaceType intType = context.typeProvider.intType;
expect(expression.staticType, intType);
}
+
+ test_staticModeHints_forStaticVariableInference() {
+ context.analysisOptions =
+ new AnalysisOptionsImpl.from(context.analysisOptions)
+ ..strongModeHints = true;
+ Source source = newSource(
+ '/test.dart',
+ r'''
+var V = [42];
+''');
+ LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
+ computeResult(target, RESOLVED_UNIT9);
+ expect(outputs[RESOLVED_UNIT9], isNotNull);
+ expect(outputs[CREATED_RESOLVED_UNIT9], isTrue);
+ // An INFERRED_TYPE_LITERAL error should be generated.
+ List<AnalysisError> errors = outputs[
+ STATIC_VARIABLE_RESOLUTION_ERRORS_IN_UNIT] as List<AnalysisError>;
+ expect(errors, hasLength(1));
+ expect(errors[0].errorCode, StrongModeCode.INFERRED_TYPE_LITERAL);
+ }
}
@reflectiveTest

Powered by Google App Engine
This is Rietveld 408576698