Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaladoc: Fix "case case Foo" in enum's cases #19519

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions scaladoc-testcases/src/tests/enumSignatures.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ package enumSignatures

enum Enum1
{
case A
case B
case C
case A //expected: case A extends Enum1
case B //expected: case B extends Enum1
case C //expected: case C extends Enum1
}
enum Enum2(val i: Int):
case A(s: String) extends Enum2/*<-*/(1)/*->*/
case B(t: String) extends Enum2/*<-*/(2)/*->*/
case C(u: String) extends Enum2/*<-*/(3)/*->*/
case A(s: String) extends Enum2(1) //expected: final case class A(s: String) extends Enum2
case B(t: String) extends Enum2(2) //expected: final case class B(t: String) extends Enum2
case C(u: String) extends Enum2(3) //expected: final case class C(u: String) extends Enum2

enum Enum3(val param: Int):
case A extends Enum3/*<-*/(1)/*->*/ with A
case B extends Enum3/*<-*/(2)/*->*/
case C extends Enum3/*<-*/(3)/*->*/

enum Enum4[+T]:
case G(s: String)
case G(s: String) //expected: final case class G[+T](s: String)
case B extends Enum4[Int] with A
case C[V](s: String) extends Enum4[V]
case D[T](s: String) extends Enum4[T]
case C[V](s: String) extends Enum4[V] //expected: final case class C[V](s: String) extends Enum4[V]
case D[T](s: String) extends Enum4[T] //expected: final case class D[T](s: String) extends Enum4[T]

trait A
6 changes: 3 additions & 3 deletions scaladoc/src/dotty/tools/scaladoc/api.scala
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ enum Kind(val name: String):
case Trait(override val typeParams: Seq[TypeParameter], override val argsLists: Seq[TermParameterList])
extends Kind("trait") with Classlike
case Enum(override val typeParams: Seq[TypeParameter], override val argsLists: Seq[TermParameterList]) extends Kind("enum") with Classlike
case EnumCase(kind: Object.type | Kind.Type | Val.type | Class) extends Kind("case")
case EnumCase(kind: Object.type | Kind.Type | Val.type | Class) extends Kind(kind.name)
case Def(paramLists: Seq[Either[TermParameterList,TypeParameterList]])
extends Kind("def")
case Extension(on: ExtensionTarget, m: Kind.Def) extends Kind("def")
Expand Down Expand Up @@ -146,9 +146,9 @@ case class HierarchyGraph(edges: Seq[(LinkToType, LinkToType)], sealedNodes: Set
def vertecies: Seq[LinkToType] = edges.flatten((a, b) => Seq(a, b)).distinct
def verteciesWithId: Map[LinkToType, Int] = vertecies.zipWithIndex.toMap
def +(edge: (LinkToType, LinkToType)): HierarchyGraph = this ++ Seq(edge)
def ++(edges: Seq[(LinkToType, LinkToType)]): HierarchyGraph =
def ++(edges: Seq[(LinkToType, LinkToType)]): HierarchyGraph =
this.copy(edges = this.edges.view.concat(edges).distinct.toSeq)

object HierarchyGraph:
def empty = HierarchyGraph(Seq.empty)
def withEdges(edges: Seq[(LinkToType, LinkToType)]) = HierarchyGraph.empty ++ edges
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class ScalaSignatureProvider:

MemberSignature(
builder.modifiersAndVisibility(entry),
builder.kind(entry.kind),
List(),
builder.name(entry.name, entry.dri),
builder.keyword(" extends ").signature(modifiedType)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ExtensionMethodParamsSignature extends SignatureTest("extensionParams", Si

class ClassModifiers extends SignatureTest("classModifiers", SignatureTest.classlikeKinds)

class EnumSignatures extends SignatureTest("enumSignatures", SignatureTest.all)
class EnumSignatures extends SignatureTest("enumSignatures", "case" +: SignatureTest.all)

class StructuralTypes extends SignatureTest("structuralTypes", SignatureTest.members)

Expand Down
Loading