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

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: Restore TODO. 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
« no previous file with comments | « pkg/analyzer/test/generated/checked_mode_compile_time_error_code_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..1b755f930fd27531eb65954579648e77d48b0f6b 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,12 @@ class B {
final a;
}
var b = const B();''');
- // TODO(paulberry): the error INVALID_CONSTAT is redundant and ought to be
- // suppressed.
+ // TODO(scheglov): the error CONST_EVAL_THROWS_EXCEPTION is redundant and
+ // ought to be suppressed. Or not?
await computeAnalysisResult(source);
assertErrors(source, [
CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER,
- CompileTimeErrorCode.INVALID_CONSTANT
+ CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION
]);
verify([source]);
}
« no previous file with comments | « pkg/analyzer/test/generated/checked_mode_compile_time_error_code_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698