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

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

Issue 15271006: Report DUPLICATE_CONSTRUCTOR_NAME and other scope fixes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revert most changes and mark tests invalid. Created 7 years, 7 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 4f8f9a85bbd9e9513e8c5536252312dac53d3d4b..db201bd7b4d840d89c42e4129cd820eeead67264 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
@@ -381,6 +381,20 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test__parameterWithFunctionName_local() throws Exception {
+ Source source = addSource(createSource(//
+ "main() {",
+ " f(f) {}",
+ "}"));
+ resolve(source);
+ assertErrors(
+ CompileTimeErrorCode.DUPLICATE_DEFINITION,
+ CompileTimeErrorCode.DUPLICATE_DEFINITION,
+ CompileTimeErrorCode.DUPLICATE_DEFINITION,
+ CompileTimeErrorCode.DUPLICATE_DEFINITION);
+ verify(source);
+ }
+
public void test_ambiguousExport() throws Exception {
Source source = addSource(createSource(//
"library L;",
@@ -916,6 +930,44 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_duplicateConstructorName_named() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " A.a() {}",
+ " A.a() {}",
+ "}"));
+ resolve(source);
+ assertErrors(
+ CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME,
+ CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME);
+ verify(source);
+ }
+
+ public void test_duplicateConstructorName_unnamed() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " A() {}",
+ " A() {}",
+ "}"));
+ resolve(source);
+ assertErrors(
+ CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT,
+ CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT);
+ verify(source);
+ }
+
+ public void test_duplicateDefinition_parameterWithFunctionName_topLevel() throws Exception {
+ Source source = addSource(createSource(//
+ "f(f) {}"));
+ resolve(source);
+ assertErrors(
+ CompileTimeErrorCode.DUPLICATE_DEFINITION,
+ CompileTimeErrorCode.DUPLICATE_DEFINITION,
+ CompileTimeErrorCode.DUPLICATE_DEFINITION,
+ CompileTimeErrorCode.DUPLICATE_DEFINITION);
+ verify(source);
+ }
+
public void test_duplicateMemberError() throws Exception {
Source librarySource = addSource("/lib.dart", createSource(//
"library lib;",
@@ -1435,7 +1487,7 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
Source source = addSource(createSource(//
"class A {",
" A(p) {}",
- " A() : super(f);",
+ " A.named() : this(f);",
" var f;",
"}"));
resolve(source);

Powered by Google App Engine
This is Rietveld 408576698