Closed
Description
The following code:
typedef TD<T> = T;
/// [T]
extension type ET<T>(TD<T> _) {}
crashes dartdoc with the following error:
Stack trace
dartdoc 8.0.9 (/Users/srujzs/Downloads/testdartdoc/dartdev) failed: type 'TypeParameterTypeImpl' is not a subtype of type 'ParameterizedType' in type cast
#0 new DefinedElementType._from (package:dartdoc/src/element_type.dart:281:16)
#1 new ElementType.for_ (package:dartdoc/src/element_type.dart:45:31)
#2 Nameable.getTypeFor (package:dartdoc/src/model/nameable.dart:85:19)
#3 ExtensionType.representationType (package:dartdoc/src/model/extension_type.dart:16:7)
#4 ExtensionType.representationType (package:dartdoc/src/model/extension_type.dart)
#5 ExtensionType.referenceChildren (package:dartdoc/src/model/extension_type.dart:79:10)
#6 CommentReferable.referenceBy (package:dartdoc/src/model/comment_referable.dart:64:38)
#7 _getMatchingLinkElement (package:dartdoc/src/markdown_processor.dart:176:15)
#8 getMatchingLinkElement (package:dartdoc/src/markdown_processor.dart:187:16)
#9 MarkdownDocument._makeLinkNode (package:dartdoc/src/markdown_processor.dart:313:18)
#10 new MarkdownDocument.withElementLinkResolver.<anonymous closure> (package:dartdoc/src/markdown_processor.dart:267:51)
#11 LinkSyntax._resolveReferenceLink (package:markdown/src/inline_syntaxes/link_syntax.dart:137:36)
#12 LinkSyntax._tryCreateReferenceLink (package:markdown/src/inline_syntaxes/link_syntax.dart:177:18)
#13 LinkSyntax.close (package:markdown/src/inline_syntaxes/link_syntax.dart:52:14)
#14 InlineParser._linkOrImage (package:markdown/src/inline_parser.dart:150:32)
#15 InlineParser.parse (package:markdown/src/inline_parser.dart:106:9)
#16 MarkdownDocument._parseInlineContent (package:dartdoc/src/markdown_processor.dart:298:67)
#17 MarkdownDocument._parseInlineContent (package:dartdoc/src/markdown_processor.dart:303:9)
#18 MarkdownDocument.parseMarkdownText (package:dartdoc/src/markdown_processor.dart:288:5)
#19 Documentation._parseDocumentation (package:dartdoc/src/model/documentation.dart:78:21)
#20 Documentation._renderDocumentation (package:dartdoc/src/model/documentation.dart:59:23)
#21 Documentation.asHtml (package:dartdoc/src/model/documentation.dart:44:5)
#22 DocumentationComment.documentationAsHtml (package:dartdoc/src/model/documentation_comment.dart:62:49)
#23 DocumentationComment.documentationAsHtml (package:dartdoc/src/model/documentation_comment.dart)
#24 EmptyGenerator.generate (package:dartdoc/src/generator/empty_generator.dart:27:25)
#25 Dartdoc.generateDocsBase (package:dartdoc/src/dartdoc.dart:203:21)
<asynchronous suspension>
#26 Dartdoc.generateDocs (package:dartdoc/src/dartdoc.dart:241:24)
<asynchronous suspension>
#27 Dartdoc.executeGuarded.<anonymous closure> (package:dartdoc/src/dartdoc.dart:273:9)
<asynchronous suspension>
Removing the typedef and just making the representation type T
doesn't reproduce the error. Removing the doc comment doesn't reproduce the error.
Dart SDK version: 3.5.0-edge.667fa314c8e754125ba9a601a30a4587c68f6c3d (main) (Tue Jun 11 14:19:26 2024 -0700) on "macos_arm64"
This was discovered when running the try bots in https://dart-review.googlesource.com/c/sdk/+/370663. pkg-linux-release-try
fails when trying to validate the SDK API docs.