Skip to content

Commit 45ed5e2

Browse files
committed
Add explanation how isSyntheticEvidence works
1 parent c3029e6 commit 45ed5e2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,13 @@ trait ClassLikeSupport:
619619

620620
def isSyntheticEvidence(name: String) =
621621
if !name.startsWith(NameKinds.EvidenceParamName.separator) then false else
622+
// This assumes that every parameter that starts with `evidence$` and is implicit is generated by compiler to desugar context bound.
623+
// Howrever, this is just a heuristic, so
624+
// `def foo[A](evidence$1: ClassTag[A]) = 1`
625+
// will be documented as
626+
// `def foo[A: ClassTag] = 1`.
627+
// Scala spec states that `$` should not be used in names and behaviour may be undefiend in such case.
628+
// Documenting method slightly different then its definition is withing the 'undefiend behaviour'.
622629
symbol.paramSymss.flatten.find(_.name == name).exists(_.flags.is(Flags.Implicit))
623630

624631
def handlePolyType(polyType: PolyType): MemberInfo =

scaladoc/test/dotty/tools/scaladoc/signatures/SignatureTest.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ abstract class SignatureTest(
5151
val unexpectedReport = Option.when(!unexpected.isEmpty)
5252
(s"Unexpectedly documented signatures:\n${unexpected.mkString("\n")}")
5353

54-
println("Expecting following signatures: " + expectedFromSources)
55-
5654
val reports = missingReport ++ unexpectedReport
5755

5856
if !reports.isEmpty then

0 commit comments

Comments
 (0)