Skip to content

Commit 12257ae

Browse files
committed
Remove Context form Constraints
1 parent c78ba22 commit 12257ae

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

compiler/src/dotty/tools/dotc/quoted/reflect/ReflectionCompilerInterface.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
6060
val ctx = rootContext.fresh.setFreshGADTBounds.addMode(Mode.GadtConstraintInference)
6161
dotty.tools.dotc.quoted.QuoteContext()(using ctx)
6262

63-
def Constraints_add(self: Context)(syms: List[Symbol]): Boolean =
64-
self.gadt.addToConstraint(syms)
63+
def Constraints_add(syms: List[Symbol]): Boolean =
64+
rootContext.gadt.addToConstraint(syms)
6565

66-
def Constraints_approximation(self: Context)(sym: Symbol, fromBelow: Boolean): Type =
67-
self.gadt.approximation(sym, fromBelow)
66+
def Constraints_approximation(sym: Symbol, fromBelow: Boolean): Type =
67+
rootContext.gadt.approximation(sym, fromBelow)
6868

6969
////////////
7070
// Source //

library/src-bootstrapped/scala/internal/quoted/Matcher.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ object Matcher {
156156
// that we have found and seal them in a quoted.Type
157157
matchings.asOptionOfTuple.map { tup =>
158158
Tuple.fromArray(tup.toArray.map { // TODO improve performance
159-
case x: SymBinding => qctx.tasty.Constraints_approximation(summon[Context])(x.sym, !x.fromAbove).seal
159+
case x: SymBinding => qctx.tasty.Constraints_approximation(x.sym, !x.fromAbove).seal
160160
case x => x
161161
})
162162
}
@@ -173,7 +173,7 @@ object Matcher {
173173
// that we have found and seal them in a quoted.Type
174174
matchings.asOptionOfTuple.map { tup =>
175175
Tuple.fromArray(tup.toArray.map { // TODO improve performance
176-
case x: SymBinding => qctx.tasty.Constraints_approximation(summon[Context])(x.sym, !x.fromAbove).seal
176+
case x: SymBinding => qctx.tasty.Constraints_approximation(x.sym, !x.fromAbove).seal
177177
case x => x
178178
})
179179
}
@@ -318,7 +318,7 @@ object Matcher {
318318
fn1 =?= fn2 &&& args1 =?= args2
319319

320320
case (Block(stats1, expr1), Block(binding :: stats2, expr2)) if isTypeBinding(binding) =>
321-
qctx.tasty.Constraints_add(summon[Context])(binding.symbol :: Nil)
321+
qctx.tasty.Constraints_add(binding.symbol :: Nil)
322322
matched(new SymBinding(binding.symbol, hasFromAboveAnnotation(binding.symbol))) &&& Block(stats1, expr1) =?= Block(stats2, expr2)
323323

324324
/* Match block */
@@ -335,7 +335,7 @@ object Matcher {
335335

336336
case (scrutinee, Block(typeBindings, expr2)) if typeBindings.forall(isTypeBinding) =>
337337
val bindingSymbols = typeBindings.map(_.symbol)
338-
qctx.tasty.Constraints_add(summon[Context])(bindingSymbols)
338+
qctx.tasty.Constraints_add(bindingSymbols)
339339
bindingSymbols.foldRight(scrutinee =?= expr2)((x, acc) => matched(new SymBinding(x, hasFromAboveAnnotation(x))) &&& acc)
340340

341341
/* Match if */

library/src/scala/internal/tasty/CompilerInterface.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ trait CompilerInterface extends scala.tasty.reflect.Types {
3434
/////////////////
3535

3636
def Constraints_context[T]: scala.quoted.QuoteContext
37-
def Constraints_add(self: Context)(syms: List[Symbol]): Boolean
38-
def Constraints_approximation(self: Context)(sym: Symbol, fromBelow: Boolean): Type
37+
def Constraints_add(syms: List[Symbol]): Boolean
38+
def Constraints_approximation(sym: Symbol, fromBelow: Boolean): Type
3939

4040
////////////
4141
// Source //

0 commit comments

Comments
 (0)