Skip to content

Commit 3798b6f

Browse files
committed
Update to given
1 parent 3e658c4 commit 3798b6f

File tree

6 files changed

+35
-35
lines changed

6 files changed

+35
-35
lines changed

compiler/src/dotty/tools/dotc/tastyreflect/ReflectionCompilerInterface.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -617,21 +617,21 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
617617
def Match_copy(original: Tree)(selector: Term, cases: List[CaseDef])(given Context): Match =
618618
tpd.cpy.Match(original)(selector, cases)
619619

620-
type ImpliedMatch = tpd.Match
620+
type GivenMatch = tpd.Match
621621

622-
def isInstanceOfImpliedMatch(given ctx: Context): IsInstanceOf[ImpliedMatch] = new {
623-
def runtimeClass: Class[?] = classOf[ImpliedMatch]
624-
override def unapply(x: Any): Option[ImpliedMatch] = x match
622+
def isInstanceOfGivenMatch(given ctx: Context): IsInstanceOf[GivenMatch] = new {
623+
def runtimeClass: Class[?] = classOf[GivenMatch]
624+
override def unapply(x: Any): Option[GivenMatch] = x match
625625
case x: tpd.Match if x.selector.isEmpty => Some(x)
626626
case _ => None
627627
}
628628

629-
def ImplicitMatch_cases(self: Match)(given Context): List[CaseDef] = self.cases
629+
def GivenMatch_cases(self: Match)(given Context): List[CaseDef] = self.cases
630630

631-
def ImplicitMatch_apply(cases: List[CaseDef])(given Context): ImpliedMatch =
631+
def GivenMatch_apply(cases: List[CaseDef])(given Context): GivenMatch =
632632
withDefaultPos(tpd.Match(tpd.EmptyTree, cases))
633633

634-
def ImplicitMatch_copy(original: Tree)(cases: List[CaseDef])(given Context): ImpliedMatch =
634+
def GivenMatch_copy(original: Tree)(cases: List[CaseDef])(given Context): GivenMatch =
635635
tpd.cpy.Match(original)(tpd.EmptyTree, cases)
636636

637637
type Try = tpd.Try

library/src/scala/tasty/reflect/CompilerInterface.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import scala.runtime.quoted.Unpickler
3232
* | +- Closure
3333
* | +- If
3434
* | +- Match
35-
* | +- ImpliedMatch
35+
* | +- GivenMatch
3636
* | +- Try
3737
* | +- Return
3838
* | +- Repeated
@@ -466,15 +466,15 @@ trait CompilerInterface {
466466
def Match_apply(selector: Term, cases: List[CaseDef])(given ctx: Context): Match
467467
def Match_copy(original: Tree)(selector: Term, cases: List[CaseDef])(given ctx: Context): Match
468468

469-
/** Tree representing a pattern match `delegate match { ... }` in the source code */
470-
type ImpliedMatch <: Term
469+
/** Tree representing a pattern match `given match { ... }` in the source code */
470+
type GivenMatch <: Term
471471

472-
def isInstanceOfImpliedMatch(given ctx: Context): IsInstanceOf[ImpliedMatch]
472+
def isInstanceOfGivenMatch(given ctx: Context): IsInstanceOf[GivenMatch]
473473

474-
def ImplicitMatch_cases(self: ImpliedMatch)(given ctx: Context): List[CaseDef]
474+
def GivenMatch_cases(self: GivenMatch)(given ctx: Context): List[CaseDef]
475475

476-
def ImplicitMatch_apply(cases: List[CaseDef])(given ctx: Context): ImpliedMatch
477-
def ImplicitMatch_copy(original: Tree)(cases: List[CaseDef])(given ctx: Context): ImpliedMatch
476+
def GivenMatch_apply(cases: List[CaseDef])(given ctx: Context): GivenMatch
477+
def GivenMatch_copy(original: Tree)(cases: List[CaseDef])(given ctx: Context): GivenMatch
478478

479479
/** Tree representing a tyr catch `try x catch { ... } finally { ... }` in the source code */
480480
type Try <: Term

library/src/scala/tasty/reflect/Core.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ package scala.tasty.reflect
2929
* | +- Closure
3030
* | +- If
3131
* | +- Match
32-
* | +- ImpliedMatch
32+
* | +- GivenMatch
3333
* | +- Try
3434
* | +- Return
3535
* | +- Repeated
@@ -204,8 +204,8 @@ trait Core {
204204
/** Tree representing a pattern match `x match { ... }` in the source code */
205205
type Match = internal.Match
206206

207-
/** Tree representing a pattern match `delegate match { ... }` in the source code */ // TODO: drop
208-
type ImpliedMatch = internal.ImpliedMatch
207+
/** Tree representing a pattern match `given match { ... }` in the source code */ // TODO: drop
208+
type GivenMatch = internal.GivenMatch
209209

210210
/** Tree representing a try catch `try x catch { ... } finally { ... }` in the source code */
211211
type Try = internal.Try

library/src/scala/tasty/reflect/ExtractorsPrinter.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ class ExtractorsPrinter[R <: Reflection & Singleton](val tasty: R) extends Print
9191
this += "Closure(" += meth += ", " += tpt += ")"
9292
case Match(selector, cases) =>
9393
this += "Match(" += selector += ", " ++= cases += ")"
94-
case ImpliedMatch(cases) =>
95-
this += "ImpliedMatch(" ++= cases += ")"
94+
case GivenMatch(cases) =>
95+
this += "GivenMatch(" ++= cases += ")"
9696
case Return(expr) =>
9797
this += "Return(" += expr += ")"
9898
case While(cond, body) =>

library/src/scala/tasty/reflect/SourceCodePrinter.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,8 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
476476
this += highlightKeyword(" match")
477477
inBlock(printCases(cases, lineBreak()))
478478

479-
case ImpliedMatch(cases) =>
480-
this += highlightKeyword("delegate match") // TODO: drop
479+
case GivenMatch(cases) =>
480+
this += highlightKeyword("given match") // TODO: drop
481481
inBlock(printCases(cases, lineBreak()))
482482

483483
case Try(body, cases, finallyOpt) =>

library/src/scala/tasty/reflect/TreeOps.scala

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -672,29 +672,29 @@ trait TreeOps extends Core {
672672
def cases(given ctx: Context): List[CaseDef] = internal.Match_cases(self)
673673
}
674674

675-
given (given Context): IsInstanceOf[ImpliedMatch] = internal.isInstanceOfImpliedMatch
675+
given (given Context): IsInstanceOf[GivenMatch] = internal.isInstanceOfGivenMatch
676676

677677
/** Scala implicit `match` term */
678-
object IsImpliedMatch
679-
@deprecated("Use _: ImpliedMatch", "")
680-
def unapply(x: ImpliedMatch): Some[ImpliedMatch] = Some(x)
678+
object IsGivenMatch
679+
@deprecated("Use _: GivenMatch", "")
680+
def unapply(x: GivenMatch): Some[GivenMatch] = Some(x)
681681

682-
object ImpliedMatch {
682+
object GivenMatch {
683683

684-
/** Creates a pattern match `delegate match { <cases: List[CaseDef]> }` */
685-
def apply(cases: List[CaseDef])(given ctx: Context): ImpliedMatch =
686-
internal.ImplicitMatch_apply(cases)
684+
/** Creates a pattern match `given match { <cases: List[CaseDef]> }` */
685+
def apply(cases: List[CaseDef])(given ctx: Context): GivenMatch =
686+
internal.GivenMatch_apply(cases)
687687

688-
def copy(original: Tree)(cases: List[CaseDef])(given ctx: Context): ImpliedMatch =
689-
internal.ImplicitMatch_copy(original)(cases)
688+
def copy(original: Tree)(cases: List[CaseDef])(given ctx: Context): GivenMatch =
689+
internal.GivenMatch_copy(original)(cases)
690690

691-
/** Matches a pattern match `delegate match { <cases: List[CaseDef]> }` */
692-
def unapply(x: ImpliedMatch)(given ctx: Context): Option[List[CaseDef]] = Some(x.cases)
691+
/** Matches a pattern match `given match { <cases: List[CaseDef]> }` */
692+
def unapply(x: GivenMatch)(given ctx: Context): Option[List[CaseDef]] = Some(x.cases)
693693

694694
}
695695

696-
given ImpliedMatchOps: (self: ImpliedMatch) {
697-
def cases(given ctx: Context): List[CaseDef] = internal.ImplicitMatch_cases(self)
696+
given GivenMatchOps: (self: GivenMatch) {
697+
def cases(given ctx: Context): List[CaseDef] = internal.GivenMatch_cases(self)
698698
}
699699

700700
given (given Context): IsInstanceOf[Try] = internal.isInstanceOfTry

0 commit comments

Comments
 (0)