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

Unified Diff: compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java

Issue 10825335: Issue 4294. Const constructor cannot call methods (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
« no previous file with comments | « compiler/java/com/google/dart/compiler/resolver/CompileTimeConstantAnalyzer.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java b/compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java
index 5a84fa6b0eefa8b3649e58fb94381a0897ea85a1..c839a4bd25fde45075a868b1d8f9a244b73bf61e 100644
--- a/compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java
+++ b/compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java
@@ -119,7 +119,46 @@ public class CompileTimeConstantTest extends ResolverTestCase {
""),
errEx(ResolverErrorCode.EXPECTED_CONSTANT_EXPRESSION, 6, 18, 5));
}
-
+
+ /**
+ * <p>
+ * http://code.google.com/p/dart/issues/detail?id=4294
+ */
+ public void test_constConstructor_redirectInvocation() throws Exception {
+ resolveAndTestCtConstExpectErrors(
+ Joiner.on("\n").join(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class Object {}",
+ "class A {",
+ " final v;",
+ " const A(this.v);",
+ " const A.hasValue() : this(generateValue());",
+ " static generateValue() => 42;",
+ "}"),
+ errEx(ResolverErrorCode.EXPECTED_CONSTANT_EXPRESSION, 6, 29, 15));
+ }
+
+ /**
+ * <p>
+ * http://code.google.com/p/dart/issues/detail?id=4294
+ */
+ public void test_constConstructor_superInvocation() throws Exception {
+ resolveAndTestCtConstExpectErrors(
+ Joiner.on("\n").join(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class Object {}",
+ "class A {",
+ " final v;",
+ " const A(this.v);",
+ "}",
+ "class B extends A {",
+ " const A() : super(generateValue());",
+ " static generateValue() => 42;",
+ "}",
+ ""),
+ errEx(ResolverErrorCode.EXPECTED_CONSTANT_EXPRESSION, 8, 21, 15));
+ }
+
/**
* At compile time we "trust" user that parameter will have correct type.
*/
« no previous file with comments | « compiler/java/com/google/dart/compiler/resolver/CompileTimeConstantAnalyzer.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698