Skip to content

Commit 8e54f11

Browse files
committed
Remove GivenMatch from reflection API
1 parent 8f42062 commit 8e54f11

File tree

4 files changed

+0
-59
lines changed

4 files changed

+0
-59
lines changed

compiler/src/scala/quoted/runtime/impl/QuoteContextImpl.scala

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -795,29 +795,6 @@ class QuoteContextImpl private (using val ctx: Context) extends QuoteContext, Qu
795795
end extension
796796
end MatchMethodsImpl
797797

798-
type GivenMatch = tpd.Match
799-
800-
object GivenMatchTypeTest extends TypeTest[Tree, GivenMatch]:
801-
def unapply(x: Tree): Option[GivenMatch & x.type] = x match
802-
case x: (tpd.Match & x.type) if x.selector.isEmpty => Some(x)
803-
case _ => None
804-
end GivenMatchTypeTest
805-
806-
object GivenMatch extends GivenMatchModule:
807-
def apply(cases: List[CaseDef]): GivenMatch =
808-
withDefaultPos(tpd.Match(tpd.EmptyTree, cases))
809-
def copy(original: Tree)(cases: List[CaseDef]): GivenMatch =
810-
tpd.cpy.Match(original)(tpd.EmptyTree, cases)
811-
def unapply(x: GivenMatch): Option[List[CaseDef]] =
812-
Some(x.cases)
813-
end GivenMatch
814-
815-
object GivenMatchMethodsImpl extends GivenMatchMethods:
816-
extension (self: GivenMatch):
817-
def cases: List[CaseDef] = self.cases
818-
end extension
819-
end GivenMatchMethodsImpl
820-
821798
type Try = tpd.Try
822799

823800
object TryTypeTest extends TypeTest[Tree, Try]:

compiler/src/scala/quoted/runtime/impl/printers/Extractors.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ object Extractors {
9595
this += "Closure(" += meth += ", " += tpt += ")"
9696
case Match(selector, cases) =>
9797
this += "Match(" += selector += ", " ++= cases += ")"
98-
case GivenMatch(cases) =>
99-
this += "GivenMatch(" ++= cases += ")"
10098
case Return(expr, from) =>
10199
this += "Return(" += expr += ", " += from += ")"
102100
case While(cond, body) =>

compiler/src/scala/quoted/runtime/impl/printers/SourceCode.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,10 +486,6 @@ object SourceCode {
486486
this += highlightKeyword(" match")
487487
inBlock(printCases(cases, lineBreak()))
488488

489-
case GivenMatch(cases) =>
490-
this += highlightKeyword("given match") // TODO: drop
491-
inBlock(printCases(cases, lineBreak()))
492-
493489
case Try(body, cases, finallyOpt) =>
494490
this += highlightKeyword("try ")
495491
printTree(body)

library/src/scala/quoted/QuoteContext.scala

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,6 @@ trait QuoteContext { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
578578
*/
579579
def unique(qualifier: Term, name: String): Select
580580

581-
// TODO rename, this returns an Apply and not a Select
582581
/** Call an overloaded method with the given type and term parameters */
583582
def overloaded(qualifier: Term, name: String, targs: List[TypeRepr], args: List[Term]): Apply
584583

@@ -1031,35 +1030,6 @@ trait QuoteContext { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
10311030
end extension
10321031
end MatchMethods
10331032

1034-
/** Tree representing a pattern match `given match { ... }` in the source code */ // TODO: drop
1035-
type GivenMatch <: Term
1036-
1037-
given TypeTest[Tree, GivenMatch] = GivenMatchTypeTest
1038-
protected val GivenMatchTypeTest: TypeTest[Tree, GivenMatch]
1039-
1040-
/** Scala implicit `match` term */
1041-
val GivenMatch: GivenMatchModule
1042-
1043-
trait GivenMatchModule { this: GivenMatch.type =>
1044-
1045-
/** Creates a pattern match `given match { <cases: List[CaseDef]> }` */
1046-
def apply(cases: List[CaseDef]): GivenMatch
1047-
1048-
def copy(original: Tree)(cases: List[CaseDef]): GivenMatch
1049-
1050-
/** Matches a pattern match `given match { <cases: List[CaseDef]> }` */
1051-
def unapply(x: GivenMatch): Option[List[CaseDef]]
1052-
}
1053-
1054-
given GivenMatchMethods as GivenMatchMethods = GivenMatchMethodsImpl
1055-
protected val GivenMatchMethodsImpl: GivenMatchMethods
1056-
1057-
trait GivenMatchMethods:
1058-
extension (self: GivenMatch):
1059-
def cases: List[CaseDef]
1060-
end extension
1061-
end GivenMatchMethods
1062-
10631033
/** Tree representing a try catch `try x catch { ... } finally { ... }` in the source code */
10641034
type Try <: Term
10651035

0 commit comments

Comments
 (0)