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

Unified Diff: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java

Issue 387003003: Generate compile errors for illegal uses of const Symbol constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
index cc2c2c582c912fe863420b1bda6b8a38ac2fda6d..2d32153c0edc66f4ab2e4b26dbcfb9f95e79855c 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
@@ -4147,6 +4147,26 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_symbol_constructor_badArgs() throws Exception {
+ Source source = addSource(createSource(//
+ "var s1 = const Symbol('3');", // illegal symbol
+ "var s2 = const Symbol(3);", // wrong type
+ "var s3 = const Symbol();", // too few args
+ "var s4 = const Symbol('x', 'y');", // too any args
+ "var s5 = const Symbol('x', foo: 'x');" // unexpected named arg
+ ));
+ resolve(source);
+ assertErrors(
+ source,
+ CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
+ CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
+ StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE,
+ CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS,
+ CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS,
+ CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER);
+ verify(source);
+ }
+
public void test_typeAliasCannotReferenceItself_11987() throws Exception {
Source source = addSource(createSource(//
"typedef void F(List<G> l);",

Powered by Google App Engine
This is Rietveld 408576698