Skip to content
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

Scalameta: don't use deprecated methods (v4.7.4) #3461

Merged
merged 1 commit into from
Feb 13, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ class FormatOps(
val fullInfix = InfixSplits.findEnclosingInfix(app)
val ok = isEnclosedInParens(fullInfix) || fullInfix.parent.forall {
case t: Defn.Val => t.rhs eq fullInfix
case t: Defn.Var => t.rhs.contains(fullInfix)
case t: Defn.Var => t.body eq fullInfix
case _ => true
}
if (ok)
Expand Down Expand Up @@ -2650,7 +2650,6 @@ class FormatOps(
def getBlocks(ft: FormatToken, nft: FormatToken, all: Boolean): Result =
ft.meta.leftOwner match {
case t: Ctor.Secondary => Some((t, seq(all, t.init, t.stats)))
case t: Defn.Var => t.rhs.map(_ -> Nil)
case t: Tree.WithBody => Some((t.body, Nil))
case _ => BlockImpl.getBlocks(ft, nft, all)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,16 +332,8 @@ object TreeOps {
@tailrec
def defDefBody(tree: Tree): Option[Tree] =
tree match {
case d: Defn.Def => Some(d.body)
case d: Defn.Macro => Some(d.body)
case d: Defn.Given => Some(d.templ)
case d: Defn.GivenAlias => Some(d.body)
case d: Defn.Val => Some(d.rhs)
case d: Defn.Var => d.rhs
case t: Defn.Class => Some(t.templ)
case t: Defn.Trait => Some(t.templ)
case t: Defn.Enum => Some(t.templ)
case t: Defn.ExtensionGroup => Some(t.body)
case d: Defn with Tree.WithBody => Some(d.body)
case d: Defn with Stat.WithTemplate => Some(d.templ)
case t: Ctor.Secondary => Some(t.init)
case _: Ctor.Primary | _: Pat.Var | _: Term.Name =>
tree.parent match {
Expand Down Expand Up @@ -451,7 +443,6 @@ object TreeOps {
new FormatToken.ExtractFromMeta(_.leftOwner match {
case _: Enumerator => None // it's WithBody
case t: Ctor.Secondary => Some(t.init)
case t: Defn.Var => t.rhs.orElse(Some(t)) // `_` replaced with None
case t: Tree.WithBody => Some(t.body)
case t: Term.Param => t.default
case _ => None
Expand Down Expand Up @@ -739,7 +730,8 @@ object TreeOps {
t.parent match {
case Some(ts: Term.Select) if ts.name.value == "stripMargin" =>
ts.parent match {
case Some(Term.Apply(_, List(arg: Lit.Char))) => Some(arg.value)
case Some(Term.Apply.Initial(_, List(arg: Lit.Char))) =>
Some(arg.value)
case _ => Some('|')
}
case _ => None
Expand Down