diff --git a/scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala b/scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala index 433129835053..b1b3cac11e50 100644 --- a/scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala +++ b/scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala @@ -254,8 +254,11 @@ trait ClassLikeSupport: dd.symbol.extendedSymbol.map { extSym => val memberInfo = unwrapMemberInfo(c, dd.symbol) val typeParams = dd.symbol.extendedTypeParams.map(mkTypeArgument(_, memberInfo.genericTypes)) - val termParams = dd.symbol.extendedTermParamLists.zipWithIndex.map { case (paramList, index) => - ParametersList(paramList.params.map(mkParameter(_, memberInfo = memberInfo.paramLists(index))), paramListModifier(paramList.params)) + val termParams = dd.symbol.extendedTermParamLists.zipWithIndex.flatMap { case (paramList, index) => + memberInfo.paramLists(index) match + case EvidenceOnlyParameterList => Nil + case info: RegularParameterList => + Seq(ParametersList(paramList.params.map(mkParameter(_, memberInfo = info)), paramListModifier(paramList.params))) } val target = ExtensionTarget( extSym.symbol.normalizedName, @@ -630,13 +633,13 @@ trait ClassLikeSupport: def unwrapMemberInfo(c: ClassDef, symbol: Symbol): MemberInfo = val baseTypeRepr = memberInfo(c, symbol) - def isSyntheticEvidence(name: String) = + def isSyntheticEvidence(name: String) = if !name.startsWith(NameKinds.EvidenceParamName.separator) then false else // This assumes that every parameter that starts with `evidence$` and is implicit is generated by compiler to desugar context bound. - // Howrever, this is just a heuristic, so - // `def foo[A](evidence$1: ClassTag[A]) = 1` + // Howrever, this is just a heuristic, so + // `def foo[A](evidence$1: ClassTag[A]) = 1` // will be documented as - // `def foo[A: ClassTag] = 1`. + // `def foo[A: ClassTag] = 1`. // Scala spec states that `$` should not be used in names and behaviour may be undefiend in such case. // Documenting method slightly different then its definition is withing the 'undefiend behaviour'. symbol.paramSymss.flatten.find(_.name == name).exists(_.flags.is(Flags.Implicit)) @@ -647,7 +650,7 @@ trait ClassLikeSupport: def handleMethodType(memberInfo: MemberInfo, methodType: MethodType): MemberInfo = val rawParams = methodType.paramNames.zip(methodType.paramTypes).toMap val (evidences, notEvidences) = rawParams.partition(e => isSyntheticEvidence(e._1)) - + def findParamRefs(t: TypeRepr): Seq[ParamRef] = t match case paramRef: ParamRef => Seq(paramRef) @@ -665,7 +668,7 @@ trait ClassLikeSupport: case (_, AppliedType(tpe, List(typeParam: ParamRef))) => Right(nameForRef(typeParam) -> tpe.asSignature) case (name, original) => - findParamRefs(original) match + findParamRefs(original) match case Nil => Left((name, original)) case typeParam :: _ => val name = nameForRef(typeParam)