Skip to content

Commit

Permalink
Display the immediate representation type, not any erasure (#3685)
Browse files Browse the repository at this point in the history
  • Loading branch information
srawlins authored Feb 27, 2024
1 parent 91c361a commit d8e7f99
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/src/model/extension_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ExtensionType extends InheritingContainer
final ExtensionTypeElement element;

late final ElementType representationType =
getTypeFor(element.typeErasure, library);
getTypeFor(element.representation.type, library);

ExtensionType(this.element, super.library, super.packageGraph);

Expand Down
15 changes: 14 additions & 1 deletion test/templates/extension_type_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ extension type One<E>(List<E> it) {
]);
}

void test_representationType() async {
void test_representationType_class() async {
await createPackageWithLibrary('''
class Foo<E> {}
extension type One<E>(Foo<E> it) {}
Expand All @@ -81,6 +81,19 @@ extension type One<E>(Foo<E> it) {}
]);
}

void test_representationType_extensionType() async {
await createPackageWithLibrary('''
extension type One(int one) {}
extension type Two(One two) {}
''');
var htmlLines = readLines(['lib', 'Two-extension-type.html']);

htmlLines.expectMainContentContainsAllInOrder([
matches('<dt>on</dt>'),
matches('<a href="../lib/One-extension-type.html">One</a>'),
]);
}

void test_classInterfaces() async {
await createPackageWithLibrary('''
class Base<E> {}
Expand Down

0 comments on commit d8e7f99

Please sign in to comment.