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

Unified Diff: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java

Issue 10928230: Issue 5082. It is an error if argument to '?' is not a formal parameter (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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/type/TypeAnalyzer.java ('k') | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
index 24c841c822840954dca341fcda52568c450c9839..bf2a5e85711d25723314340180d2375fb51227d5 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -4836,6 +4836,42 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
assertErrors(result.getErrors());
}
+ /**
+ * <p>
+ * http://code.google.com/p/dart/issues/detail?id=5082
+ */
+ public void test_argumentDefinitionTest_type() throws Exception {
+ AnalyzeLibraryResult result = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "foo(p) {",
+ " ?p;",
+ "}",
+ "");
+ assertErrors(result.getErrors());
+ DartUnaryExpression unary = findNode(DartUnaryExpression.class, "?p");
+ Type type = unary.getType();
+ assertNotNull(type);
+ assertEquals("bool", type.toString());
+ }
+
+ /**
+ * <p>
+ * http://code.google.com/p/dart/issues/detail?id=5082
+ */
+ public void test_argumentDefinitionTest_shouldBeFormalParameter() throws Exception {
+ AnalyzeLibraryResult result = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "foo(p) {",
+ " var v;",
+ " ?p;",
+ " ?v;",
+ "}",
+ "");
+ assertErrors(
+ result.getErrors(),
+ errEx(ResolverErrorCode.FORMAL_PARAMETER_NAME_EXPECTED, 5, 4, 1));
+ }
+
private <T extends DartNode> T findNode(final Class<T> clazz, String pattern) {
final int index = testSource.indexOf(pattern);
assertTrue(index != -1);
« no previous file with comments | « compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698