diff --git a/lib/src/model/extension_type.dart b/lib/src/model/extension_type.dart index ca1c688470..96bfb1d025 100644 --- a/lib/src/model/extension_type.dart +++ b/lib/src/model/extension_type.dart @@ -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); diff --git a/test/templates/extension_type_test.dart b/test/templates/extension_type_test.dart index 266e22c88f..05448044ac 100644 --- a/test/templates/extension_type_test.dart +++ b/test/templates/extension_type_test.dart @@ -66,7 +66,7 @@ extension type One(List it) { ]); } - void test_representationType() async { + void test_representationType_class() async { await createPackageWithLibrary(''' class Foo {} extension type One(Foo it) {} @@ -81,6 +81,19 @@ extension type One(Foo 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('
on
'), + matches('One'), + ]); + } + void test_classInterfaces() async { await createPackageWithLibrary(''' class Base {}