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

Unified Diff: pkg/analyzer/test/src/dart/analysis/index_test.dart

Issue 2956403002: Record ClassTypeAlias(s) as subtypes. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/index.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/src/dart/analysis/index_test.dart
diff --git a/pkg/analyzer/test/src/dart/analysis/index_test.dart b/pkg/analyzer/test/src/dart/analysis/index_test.dart
index 1ab740d1d10bb84af570dbeac5619d8cf2e237a5..4c21bd138ed619e4e2a7c4282a188dbe2cbbffc3 100644
--- a/pkg/analyzer/test/src/dart/analysis/index_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/index_test.dart
@@ -916,7 +916,7 @@ class A {
..isWrittenAt('field = 5', true);
}
- test_subtypes() async {
+ test_subtypes_classDeclaration() async {
String libP = 'package:test/lib.dart;package:test/lib.dart';
provider.newFile(
_p('$testProject/lib.dart'),
@@ -975,6 +975,38 @@ class Z implements E, D {
}
}
+ test_subtypes_classTypeAlias() async {
+ String libP = 'package:test/lib.dart;package:test/lib.dart';
+ provider.newFile(
+ _p('$testProject/lib.dart'),
+ '''
+class A {}
+class B {}
+class C {}
+class D {}
+''');
+ await _indexTestUnit('''
+import 'lib.dart';
+
+class X = A with B, C;
+class Y = A with B implements C, D;
+''');
+
+ {
+ AnalysisDriverSubtype X =
+ index.subtypes.singleWhere((t) => t.name == 'X');
+ expect(X.supertypes, ['$libP;A', '$libP;B', '$libP;C']);
+ expect(X.members, isEmpty);
+ }
+
+ {
+ AnalysisDriverSubtype Y =
+ index.subtypes.singleWhere((t) => t.name == 'Y');
+ expect(Y.supertypes, ['$libP;A', '$libP;B', '$libP;C', '$libP;D']);
+ expect(Y.members, isEmpty);
+ }
+ }
+
test_subtypes_dynamic() async {
await _indexTestUnit('''
class X extends dynamic {
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/index.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698