Skip to content

Empty argument list is not shown in scaladoc in some cases #13192

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

Merged
merged 1 commit into from
Jul 30, 2021
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
27 changes: 27 additions & 0 deletions scaladoc-testcases/src/tests/emptyparens.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package tests.emptyparens

class C {
def f1()(implicit i: Int) = i

def f2()(using i: Int) = i

def f3(s: String)(implicit i: Int) = i

def f4(s: String)(using i: Int) = i

def f5()()(using i: Int) = i

def f6() = 1

def f7()() = 2

def f8(i: Int)() = 1
}

class C1()(implicit i: Int)

class C2()(using i: Int)

class C3()()

class C4()(i: Int)
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ trait SignatureBuilder extends ScalaSignatureUtils {
prefix: String = "",
suffix: String = "",
separator: String = ", ",
forcePrefixAndSuffix: Boolean = false
)(
elemOp: (SignatureBuilder, E) => SignatureBuilder
): SignatureBuilder = elements match {
case Nil => this
case Nil => if forcePrefixAndSuffix then this.text(prefix + suffix) else this
case head :: tail =>
tail.foldLeft(elemOp(text(prefix), head))((b, e) => elemOp(b.text(separator), e)).text(suffix)
}
Expand Down Expand Up @@ -85,7 +86,7 @@ trait SignatureBuilder extends ScalaSignatureUtils {
if params.isEmpty then this.text("")
else if params.size == 1 && params(0).parameters == Nil then this.text("()")
else this.list(params, separator = ""){ (bld, pList) =>
bld.list(pList.parameters, s"(${pList.modifiers}", ")"){ (bld, p) =>
bld.list(pList.parameters, s"(${pList.modifiers}", ")", forcePrefixAndSuffix = true){ (bld, p) =>
val annotationsAndModifiers = bld.annotationsInline(p)
.text(p.modifiers)
val name = p.name.fold(annotationsAndModifiers)(annotationsAndModifiers.memberName(_, p.dri).text(": "))
Expand Down