From 321f36a99703df081e4c0a1900c1c15fc7fd45f5 Mon Sep 17 00:00:00 2001 From: Andrzej Ratajczak Date: Fri, 15 Oct 2021 16:15:31 +0200 Subject: [PATCH] Fix F-Bounded types signatures --- .../src/tests/fboundedTypeParameters.scala | 5 +++++ scaladoc/src/dotty/tools/scaladoc/api.scala | 9 +++++---- .../src/dotty/tools/scaladoc/tasty/TypesSupport.scala | 4 ++-- .../signatures/TranslatableSignaturesTestCases.scala | 2 ++ 4 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 scaladoc-testcases/src/tests/fboundedTypeParameters.scala diff --git a/scaladoc-testcases/src/tests/fboundedTypeParameters.scala b/scaladoc-testcases/src/tests/fboundedTypeParameters.scala new file mode 100644 index 000000000000..69c1702673f0 --- /dev/null +++ b/scaladoc-testcases/src/tests/fboundedTypeParameters.scala @@ -0,0 +1,5 @@ +package tests +package fboundedTypeParameters + +trait AOps[X[_]] +trait A[T] extends AOps[A] diff --git a/scaladoc/src/dotty/tools/scaladoc/api.scala b/scaladoc/src/dotty/tools/scaladoc/api.scala index 320bb3486c53..fbe0f455c794 100644 --- a/scaladoc/src/dotty/tools/scaladoc/api.scala +++ b/scaladoc/src/dotty/tools/scaladoc/api.scala @@ -119,12 +119,13 @@ case class TypeParameter( case class Link(name: String, dri: DRI) -sealed trait SignaturePart +sealed trait SignaturePart: + val name: String // TODO (longterm) properly represent signatures -case class Type(name: String, dri: Option[DRI]) extends SignaturePart -case class Keyword(name: String) extends SignaturePart -case class Plain(txt: String) extends SignaturePart +case class Type(override val name: String, dri: Option[DRI]) extends SignaturePart +case class Keyword(override val name: String) extends SignaturePart +case class Plain(override val name: String) extends SignaturePart type Signature = List[SignaturePart] diff --git a/scaladoc/src/dotty/tools/scaladoc/tasty/TypesSupport.scala b/scaladoc/src/dotty/tools/scaladoc/tasty/TypesSupport.scala index 48431cb18276..d4907138c233 100644 --- a/scaladoc/src/dotty/tools/scaladoc/tasty/TypesSupport.scala +++ b/scaladoc/src/dotty/tools/scaladoc/tasty/TypesSupport.scala @@ -104,8 +104,8 @@ trait TypesSupport: inner(tpe) :+ plain("*") case AnnotatedType(tpe, _) => inner(tpe) - case tl @ TypeLambda(params, paramBounds, resType@AppliedType(tpe, args)) - if paramBounds.map(inner).forall(_.isEmpty) && params.zip(args.map(inner)).forall(List(_) == _) => + case tl @ TypeLambda(params, paramBounds, AppliedType(tpe, args)) + if paramBounds.map(inner).forall(_.isEmpty) && params.zip(args.map(inner).flatten.map(_.name)).forall(_ == _) => inner(tpe) case tl @ TypeLambda(params, paramBounds, resType) => plain("[").l ++ commas(params.zip(paramBounds).map { (name, typ) => diff --git a/scaladoc/test/dotty/tools/scaladoc/signatures/TranslatableSignaturesTestCases.scala b/scaladoc/test/dotty/tools/scaladoc/signatures/TranslatableSignaturesTestCases.scala index 7743dd256b0d..9aced84c96d0 100644 --- a/scaladoc/test/dotty/tools/scaladoc/signatures/TranslatableSignaturesTestCases.scala +++ b/scaladoc/test/dotty/tools/scaladoc/signatures/TranslatableSignaturesTestCases.scala @@ -86,3 +86,5 @@ class ImplicitConversionsTest3 extends SignatureTest( class SpecializedSignature extends SignatureTest("specializedSignature", SignatureTest.all) class ContextBounds extends SignatureTest("contextBounds", SignatureTest.all) + +class FBoundedTypeParameters extends SignatureTest("fboundedTypeParameters", SignatureTest.all)