Skip to content

Commit

Permalink
Fix F-Bounded types signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
BarkingBad committed Oct 15, 2021
1 parent af9594d commit 321f36a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
5 changes: 5 additions & 0 deletions scaladoc-testcases/src/tests/fboundedTypeParameters.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package tests
package fboundedTypeParameters

trait AOps[X[_]]
trait A[T] extends AOps[A]
9 changes: 5 additions & 4 deletions scaladoc/src/dotty/tools/scaladoc/api.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
4 changes: 2 additions & 2 deletions scaladoc/src/dotty/tools/scaladoc/tasty/TypesSupport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 321f36a

Please sign in to comment.