From 695261ce4e5e7219148cd434fea897dd3ad350c6 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Mon, 26 Feb 2024 22:39:33 -0800 Subject: [PATCH] Display the immediate representation type, not any erasure --- lib/src/model/extension_type.dart | 2 +- test/templates/extension_type_test.dart | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) 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 {}