Skip to content

Commit a356535

Browse files
Merge pull request #7593 from dotty-staging/stop-using-IsXYZ-extractors
Stop using IsXYZ extractors
2 parents c1e0e04 + bc2e06d commit a356535

File tree

18 files changed

+58
-54
lines changed

18 files changed

+58
-54
lines changed

tests/neg-macros/delegate-match-1/Macro_1.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ inline def f: Any = ${ fImpl }
66
private def fImpl(given qctx: QuoteContext): Expr[Unit] = {
77
import qctx.tasty.{_, given}
88
searchImplicit(('[A]).unseal.tpe) match {
9-
case IsImplicitSearchSuccess(x) =>
9+
case x: ImplicitSearchSuccess =>
1010
'{}
11-
case IsDivergingImplicit(x) => '{}
11+
case x: DivergingImplicit => '{}
1212
error("DivergingImplicit\n" + x.explanation, rootPosition)
1313
'{}
14-
case IsNoMatchingImplicits(x) =>
14+
case x: NoMatchingImplicits =>
1515
error("NoMatchingImplicits\n" + x.explanation, rootPosition)
1616
'{}
17-
case IsAmbiguousImplicits(x) =>
17+
case x: AmbiguousImplicits =>
1818
error("AmbiguousImplicits\n" + x.explanation, rootPosition)
1919
'{}
2020
}

tests/neg-macros/delegate-match-2/Macro_1.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ inline def f: Any = ${ fImpl }
66
private def fImpl(given qctx: QuoteContext): Expr[Unit] = {
77
import qctx.tasty.{_, given}
88
searchImplicit(('[A]).unseal.tpe) match {
9-
case IsImplicitSearchSuccess(x) =>
9+
case x: ImplicitSearchSuccess =>
1010
'{}
11-
case IsDivergingImplicit(x) => '{}
11+
case x: DivergingImplicit => '{}
1212
error("DivergingImplicit\n" + x.explanation, rootPosition)
1313
'{}
14-
case IsNoMatchingImplicits(x) =>
14+
case x: NoMatchingImplicits =>
1515
error("NoMatchingImplicits\n" + x.explanation, rootPosition)
1616
'{}
17-
case IsAmbiguousImplicits(x) =>
17+
case x: AmbiguousImplicits =>
1818
error("AmbiguousImplicits\n" + x.explanation, rootPosition)
1919
'{}
2020
}

tests/neg-macros/delegate-match-3/Macro_1.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ inline def f: Any = ${ fImpl }
66
private def fImpl(given qctx: QuoteContext): Expr[Unit] = {
77
import qctx.tasty.{_, given}
88
searchImplicit(('[A]).unseal.tpe) match {
9-
case IsImplicitSearchSuccess(x) =>
9+
case x: ImplicitSearchSuccess =>
1010
'{}
11-
case IsDivergingImplicit(x) => '{}
11+
case x: DivergingImplicit => '{}
1212
error("DivergingImplicit\n" + x.explanation, rootPosition)
1313
'{}
14-
case IsNoMatchingImplicits(x) =>
14+
case x: NoMatchingImplicits =>
1515
error("NoMatchingImplicits\n" + x.explanation, rootPosition)
1616
'{}
17-
case IsAmbiguousImplicits(x) =>
17+
case x: AmbiguousImplicits =>
1818
error("AmbiguousImplicits\n" + x.explanation, rootPosition)
1919
'{}
2020
}

tests/neg-macros/tasty-macro-assert-1/quoted_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ object Asserts {
1818
val tree = cond.unseal
1919

2020
def isOps(tpe: TypeOrBounds): Boolean = tpe match {
21-
case IsTermRef(tpe) => tpe.termSymbol.isDefDef && tpe.name == "Ops"// TODO check that the parent is Asserts
21+
case tpe: TermRef => tpe.termSymbol.isDefDef && tpe.name == "Ops"// TODO check that the parent is Asserts
2222
case _ => false
2323
}
2424

tests/neg-macros/tasty-macro-assert-2/quoted_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ object Asserts {
1818
val tree = cond.unseal
1919

2020
def isOps(tpe: TypeOrBounds): Boolean = tpe match {
21-
case IsTermRef(tpe) => tpe.termSymbol.isDefDef && tpe.name == "Ops"// TODO check that the parent is Asserts
21+
case tpe: TermRef => tpe.termSymbol.isDefDef && tpe.name == "Ops"// TODO check that the parent is Asserts
2222
case _ => false
2323
}
2424

tests/run-custom-args/Yretain-trees/tasty-extractors-owners/quoted_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ object Macros {
1414
val output = new TreeTraverser {
1515
override def traverseTree(tree: Tree)(implicit ctx: Context): Unit = {
1616
tree match {
17-
case IsDefinition(tree @ DefDef(name, _, _, _, _)) =>
17+
case tree @ DefDef(name, _, _, _, _) =>
1818
buff.append(name)
1919
buff.append("\n")
2020
buff.append(tree.symbol.owner.tree.showExtractors)
2121
buff.append("\n\n")
22-
case IsDefinition(tree @ ValDef(name, _, _)) =>
22+
case tree @ ValDef(name, _, _) =>
2323
buff.append(name)
2424
buff.append("\n")
2525
buff.append(tree.symbol.owner.tree.showExtractors)

tests/run-macros/flops-rewrite-2/Macro_1.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ private class Rewriter(preTransform: List[Transformation[_]] = Nil, postTransfor
7676
import qctx.tasty.{_, given}
7777
class MapChildren extends TreeMap {
7878
override def transformTerm(tree: Term)(given ctx: Context): Term = tree match {
79-
case IsClosure(_) =>
79+
case _: Closure =>
8080
tree
81-
case IsInlined(_) | IsSelect(_) =>
81+
case _: Inlined | _: Select =>
8282
transformChildrenTerm(tree)
8383
case _ =>
8484
tree.tpe.widen match {
85-
case IsMethodType(_) | IsPolyType(_) =>
85+
case _: MethodType | _: PolyType =>
8686
transformChildrenTerm(tree)
8787
case _ =>
8888
tree.seal match {

tests/run-macros/flops-rewrite-3/Macro_1.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ private class Rewriter private (preTransform: List[Transformation] = Nil, postTr
112112
import qctx.tasty.{_, given}
113113
class MapChildren extends TreeMap {
114114
override def transformTerm(tree: Term)(given ctx: Context): Term = tree match {
115-
case IsClosure(_) =>
115+
case _: Closure =>
116116
tree
117-
case IsInlined(_) | IsSelect(_) =>
117+
case _: Inlined | _: Select =>
118118
transformChildrenTerm(tree)
119119
case _ =>
120120
tree.tpe.widen match {
121-
case IsMethodType(_) | IsPolyType(_) =>
121+
case _: MethodType | _: PolyType =>
122122
transformChildrenTerm(tree)
123123
case _ =>
124124
tree.seal match {

tests/run-macros/flops-rewrite/Macro_1.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ private class Rewriter(preTransform: Expr[Any] => Expr[Any], postTransform: Expr
5858
import qctx.tasty.{_, given}
5959
class MapChildren extends TreeMap {
6060
override def transformTerm(tree: Term)(given ctx: Context): Term = tree match {
61-
case IsClosure(_) =>
61+
case _: Closure =>
6262
tree
63-
case IsInlined(_) | IsSelect(_) =>
63+
case _: Inlined | _: Select =>
6464
transformChildrenTerm(tree)
6565
case _ =>
6666
tree.tpe.widen match {
67-
case IsMethodType(_) | IsPolyType(_) =>
67+
case _: MethodType | _: PolyType =>
6868
transformChildrenTerm(tree)
6969
case _ =>
7070
tree.seal match {

tests/run-macros/inferred-repeated-result/test_1.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ object Macros {
1111
val methods =
1212
tree.tpe.classSymbol.get.classMethods.map { m =>
1313
val name = m.show
14-
val IsDefDef(ddef) = m.tree
15-
val returnType = ddef.returnTpt.tpe.show
16-
s"$name : $returnType"
14+
m.tree match
15+
case ddef: DefDef =>
16+
val returnType = ddef.returnTpt.tpe.show
17+
s"$name : $returnType"
1718
}.sorted
1819

1920
methods.foldLeft('{}) { (res, m) => '{ $res; println(${m}) } }

0 commit comments

Comments
 (0)