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

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

Issue 9016050: Flag methods as not being valid compile time constants (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Methods are not acceptable compile time constants Created 8 years, 12 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: 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 d037649d2b59ac136fe9cda8e90c9b0c8062c9a3..bf2926f60fbc11957f57ed982c2b99134296ec83 100644
--- a/compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java
+++ b/compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java
@@ -4,9 +4,10 @@
package com.google.dart.compiler.resolver;
-import com.google.common.base.Joiner;
import static com.google.dart.compiler.common.ErrorExpectation.errEx;
+import com.google.common.base.Joiner;
+
/**
@@ -512,4 +513,15 @@ public class CompileTimeConstantTest extends ResolverTestCase {
errEx(ResolverErrorCode.EXPECTED_CONSTANT_EXPRESSION, 4, 19, 14),
errEx(ResolverErrorCode.EXPECTED_CONSTANT_EXPRESSION, 3, 1, 39));
}
+
+ public void testInvalidDefaultParameterWithFunction() {
+ resolveAndTestCtConstExpectErrors(
+ Joiner.on("\n").join(
+ "class Object {}",
+ "class Function {}",
+ "qwerty() => () {};",
+ "topLevel([var x = qwerty]) { x(); }",
+ "main() { topLevel(); }"),
+ errEx(ResolverErrorCode.EXPECTED_CONSTANT_EXPRESSION, 4, 19, 6));
+ }
}

Powered by Google App Engine
This is Rietveld 408576698