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

Unified Diff: pkg/analyzer/test/generated/compile_time_error_code_test.dart

Issue 2825813002: Issue 29358. Fix for reporting constant errors while evaluating constructor invocations. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/generated/compile_time_error_code_test.dart
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
index 9c871e6fbe1a673ba83594d3c0198898965981b3..955a900fe573c26dacd68864b30c1c056b24eff2 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -1260,6 +1260,25 @@ class A {
verify([source]);
}
+ test_nonConstValueInInitializer_instanceCreation_inDifferentFile() async {
+ resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
+ Source source = addNamedSource(
+ '/a.dart',
+ r'''
+import 'b.dart';
+const v = const MyClass();
+''');
+ addNamedSource(
+ '/b.dart',
+ r'''
+class MyClass {
+ const MyClass([p = foo]);
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
+ }
+
test_constInitializedWithNonConstValue() async {
Source source = addSource(r'''
f(p) {
@@ -4774,12 +4793,10 @@ class B {
final a;
}
var b = const B();''');
- // TODO(paulberry): the error INVALID_CONSTAT is redundant and ought to be
- // suppressed.
await computeAnalysisResult(source);
assertErrors(source, [
CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER,
- CompileTimeErrorCode.INVALID_CONSTANT
+ CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION
Brian Wilkerson 2017/04/18 18:53:21 Seems like we still have redundant errors and ough
scheglov 2017/04/18 19:11:03 I'm restoring it (because removing it later is eas
]);
verify([source]);
}

Powered by Google App Engine
This is Rietveld 408576698