Skip to content
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
4 changes: 4 additions & 0 deletions scaladoc-testcases/src/tests/contextfunctions.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package tests.contextfunctions

val x: Int ?=> Float
= 5.0f
7 changes: 4 additions & 3 deletions scaladoc/src/dotty/tools/scaladoc/tasty/TypesSupport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,19 @@ trait TypesSupport:
++ plain(" ").l
++ inner(typeList.last)
else if t.isFunctionType then
val arrow = if t.isContextFunctionType then " ?=> " else " => "
typeList match
case Nil =>
Nil
case Seq(rtpe) =>
plain("()").l ++ keyword(" => ").l ++ inner(rtpe)
plain("()").l ++ keyword(arrow).l ++ inner(rtpe)
case Seq(arg, rtpe) =>
val partOfSignature = arg match
case byName: ByNameType => plain("(").l ++ inner(byName) ++ plain(")").l
case _ => inner(arg)
partOfSignature ++ keyword(" => ").l ++ inner(rtpe)
partOfSignature ++ keyword(arrow).l ++ inner(rtpe)
case args =>
plain("(").l ++ commas(args.init.map(inner)) ++ plain(")").l ++ keyword(" => ").l ++ inner(args.last)
plain("(").l ++ commas(args.init.map(inner)) ++ plain(")").l ++ keyword(arrow).l ++ inner(args.last)
else if t.isTupleN then
typeList match
case Nil =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,5 @@ class ContextBounds extends SignatureTest("contextBounds", SignatureTest.all)
class FBoundedTypeParameters extends SignatureTest("fboundedTypeParameters", SignatureTest.all)

class Exports extends SignatureTest("exports2", SignatureTest.all, sourceFiles = List("exports1", "exports2"))

class ContextFunctions extends SignatureTest("contextfunctions", SignatureTest.all)