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

Unified Diff: pkg/analyzer/test/generated/compile_time_error_code_test.dart

Issue 705553003: Avoid traversing classes when looking for circular references in typedefs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/compile_time_error_code_test.dart
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
index a3193bcc1d0d7f2f66f72b2c6b9dea4decb6ff40..e336325fa7c8582191a9040af0f3bd36a7f317d2 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -4415,6 +4415,22 @@ main() {
verify([source]);
}
+ void test_typeAliasCannotReferenceItself_19459() {
+ // A complex example involving multiple classes. This is legal, since
+ // typedef F references itself only via a class.
+ Source source = addSource(r'''
+class A<B, C> {}
+abstract class D {
+ f(E e);
+}
+abstract class E extends A<dynamic, F> {}
+typedef D F();
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
void test_typeAliasCannotReferenceItself_parameterType_named() {
Source source = addSource("typedef A({A a});");
resolve(source);
@@ -4444,6 +4460,7 @@ main() {
}
void test_typeAliasCannotReferenceItself_returnClass_withTypeAlias() {
+ // A typedef is allowed to indirectly reference itself via a class.
Source source = addSource(r'''
typedef C A();
typedef A B();
@@ -4451,7 +4468,7 @@ class C {
B a;
}''');
resolve(source);
- assertErrors(source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
+ assertNoErrors(source);
verify([source]);
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698