Skip to content

Commit

Permalink
Deprecate old Symbol member methods
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Aug 20, 2021
1 parent 821a0e3 commit bf35a48
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
18 changes: 6 additions & 12 deletions library/src/scala/quoted/Quotes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3588,16 +3588,14 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
def declaredFields: List[Symbol]

/** Get named non-private fields declared or inherited */
// TODO: deprecate after 3.1.x
// @deprecated("Use fieldMember", "3.2.0")
@deprecated("Use fieldMember", "3.1.0")
def memberField(name: String): Symbol

/** Get named non-private fields declared or inherited */
def fieldMember(name: String): Symbol

/** Get all non-private fields declared or inherited */
// TODO: deprecate after 3.1.x
// @deprecated("Use fieldMembers", "3.2.0")
@deprecated("Use fieldMembers", "3.1.0")
def memberFields: List[Symbol]

/** Get all non-private fields declared or inherited */
Expand All @@ -3610,16 +3608,14 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
def declaredMethods: List[Symbol]

/** Get named non-private methods declared or inherited */
// TODO: deprecate after 3.1.x
// @deprecated("Use methodMember", "3.2.0")
@deprecated("Use methodMember", "3.1.0")
def memberMethod(name: String): List[Symbol]

/** Get named non-private methods declared or inherited */
def methodMember(name: String): List[Symbol]

/** Get all non-private methods declared or inherited */
// TODO: deprecate after 3.1.x
// @deprecated("Use methodMembers", "3.2.0")
@deprecated("Use methodMembers", "3.1.0")
def memberMethods: List[Symbol]

/** Get all non-private methods declared or inherited */
Expand All @@ -3632,16 +3628,14 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
def declaredTypes: List[Symbol]

/** Type member with the given name directly declared in the class */
// TODO: deprecate after 3.1.x
// @deprecated("Use typeMember", "3.2.0")
@deprecated("Use typeMember", "3.1.0")
def memberType(name: String): Symbol

/** Type member with the given name directly declared in the class */
def typeMember(name: String): Symbol

/** Type member directly declared in the class */
// TODO: deprecate after 3.1.x
// @deprecated("Use typeMembers", "3.2.0")
@deprecated("Use typeMembers", "3.1.0")
def memberTypes: List[Symbol]

/** Type member directly declared in the class */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ trait ClassLikeSupport:
}
// TODO check given methods?
case dd: DefDef if !dd.symbol.isHiddenByVisibility && dd.symbol.isGiven && !dd.symbol.isArtifact =>
Some(dd.symbol.owner.memberType(dd.name))
Some(dd.symbol.owner.typeMember(dd.name))
.filterNot(_.exists)
.map { _ =>
parseMethod(c, dd.symbol, specificKind =
Expand Down Expand Up @@ -312,7 +312,7 @@ trait ClassLikeSupport:
case vd: ValDef if !isSyntheticField(vd.symbol) && (!vd.symbol.flags.is(Flags.Case) || !vd.symbol.flags.is(Flags.Enum)) =>
Some(parseValDef(c, vd))

case c: ClassDef if c.symbol.owner.memberMethod(c.name).exists(_.flags.is(Flags.Given)) =>
case c: ClassDef if c.symbol.owner.methodMember(c.name).exists(_.flags.is(Flags.Given)) =>
Some(parseGivenClasslike(c))

case c: ClassDef if c.symbol.shouldDocumentClasslike && !c.symbol.isGiven =>
Expand Down Expand Up @@ -348,7 +348,7 @@ trait ClassLikeSupport:
def inheritance = Some(InheritedFrom(s.symbol.owner.normalizedName, s.symbol.dri))
processTreeOpt(s)(s match
case c: ClassDef if c.symbol.shouldDocumentClasslike && !c.symbol.isGiven => Some(parseClasslike(c, signatureOnly = true))
case c: ClassDef if c.symbol.owner.memberMethod(c.name).exists(_.flags.is(Flags.Given)) => Some(parseGivenClasslike(c))
case c: ClassDef if c.symbol.owner.methodMember(c.name).exists(_.flags.is(Flags.Given)) => Some(parseGivenClasslike(c))
case other => {
val parsed = parseMember(c)(other)
parsed.map(p =>
Expand Down

0 comments on commit bf35a48

Please sign in to comment.