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

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

Issue 18140005: Report TYPE_ALIAS_CANNOT_REFERENCE_ITSELF (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: tweak Created 7 years, 6 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 6f47f6f883958f02e056033bf7a111326e8f28e5..5243fc792d8f94c90e3900558f25d270e9e2d1a9 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
@@ -3087,7 +3087,57 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
- // TODO(scheglov)
+ public void test_typeAliasCannotReferenceItself_parameterType_named() throws Exception {
+ Source source = addSource(createSource(//
+ "typedef A({A a});"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF);
+ verify(source);
+ }
+
+ public void test_typeAliasCannotReferenceItself_parameterType_positional() throws Exception {
+ Source source = addSource(createSource(//
+ "typedef A([A a]);"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF);
+ verify(source);
+ }
+
+ public void test_typeAliasCannotReferenceItself_parameterType_required() throws Exception {
+ Source source = addSource(createSource(//
+ "typedef A(A a);"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF);
+ verify(source);
+ }
+
+ public void test_typeAliasCannotReferenceItself_returnType() throws Exception {
+ Source source = addSource(createSource(//
+ "typedef A A();"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF);
+ verify(source);
+ }
+
+ public void test_typeAliasCannotReferenceItself_returnType_indirect() throws Exception {
+ Source source = addSource(createSource(//
+ "typedef B A();",
+ "typedef A B();"));
+ resolve(source);
+ assertErrors(
+ CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF,
+ CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF);
+ verify(source);
+ }
+
+ public void test_typeAliasCannotReferenceItself_typeVariableBounds() throws Exception {
+ Source source = addSource(createSource(//
+ "typedef A<T extends A>();"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF);
+ verify(source);
+ }
+
public void test_typeArgumentNotMatchingBounds_const() throws Exception {
Source source = addSource(createSource(//
"class A {}",

Powered by Google App Engine
This is Rietveld 408576698