Skip to content

Fix scaladoc CI #13236

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
Aug 2, 2021
Merged
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
19 changes: 11 additions & 8 deletions scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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))
Expand All @@ -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)
Expand All @@ -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)
Expand Down