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
1 change: 1 addition & 0 deletions scaladoc/src/dotty/tools/scaladoc/api.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ enum Modifier(val name: String, val prefix: Boolean):
case Infix extends Modifier("infix", true)
case AbsOverride extends Modifier("abstract override", true)
case Update extends Modifier("update", true)
case Consume extends Modifier("consume", true)

case class ExtensionTarget(name: String, typeParams: Seq[TypeParameter], argsLists: Seq[TermParameterList], signature: Signature, dri: DRI, position: Long)
case class ImplicitConversion(from: DRI, to: DRI)
Expand Down
2 changes: 1 addition & 1 deletion scaladoc/src/dotty/tools/scaladoc/tasty/BasicSupport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ trait BasicSupport:
)
val fqNameAllowlist =
if ccEnabled then
fqNameAllowlist0 + CaptureDefs.useAnnotFullName + CaptureDefs.consumeAnnotFullName
fqNameAllowlist0 + CaptureDefs.useAnnotFullName
else fqNameAllowlist0
val documentedSymbol = summon[Quotes].reflect.Symbol.requiredClass("java.lang.annotation.Documented")
val annotations = sym.annotations.filter { a =>
Expand Down
14 changes: 8 additions & 6 deletions scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ trait ClassLikeSupport:

extension (symbol: Symbol) {
def getExtraModifiers(): Seq[Modifier] =
val mods = SymOps.getExtraModifiers(symbol)()
if ccEnabled && symbol.flags.is(Flags.Mutable)then
mods :+ Modifier.Update
else
mods
var mods = SymOps.getExtraModifiers(symbol)()
if ccEnabled && symbol.flags.is(Flags.Mutable) then
mods :+= Modifier.Update
if ccEnabled && symbol.hasAnnotation(cc.CaptureDefs.ConsumeAnnot) then
mods :+= Modifier.Consume
mods
}

private def bareClasslikeKind(using Quotes)(symbol: reflect.Symbol): Kind =
Expand Down Expand Up @@ -452,12 +453,13 @@ trait ClassLikeSupport:
) =
val symbol = argument.symbol
val inlinePrefix = if symbol.flags.is(Flags.Inline) then "inline " else ""
val comsumePrefix = if self.ccEnabled && symbol.hasAnnotation(cc.CaptureDefs.ConsumeAnnot) then "consume " else ""
val name = symbol.normalizedName
val nameIfNotSynthetic = Option.when(!symbol.flags.is(Flags.Synthetic))(name)
val defaultValue = Option.when(symbol.flags.is(Flags.HasDefault))(Plain(" = ..."))
api.TermParameter(
symbol.getAnnotations(),
inlinePrefix + prefix(symbol),
comsumePrefix + inlinePrefix + prefix(symbol),
nameIfNotSynthetic,
symbol.dri,
argument.tpt.asSignature(classDef, symbol.owner) :++ defaultValue,
Expand Down
Loading