Skip to content

Commit 5b0935c

Browse files
committed
Remove extra QuoteMatcher
1 parent 60066a5 commit 5b0935c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ import dotty.tools.dotc.core.Symbols.*
106106
object Matcher {
107107
import tpd.*
108108

109-
class QuoteMatcher(val quotes: Quotes)(using Context) {
109+
class QuoteMatcher(using Context) {
110110

111111
// TODO improve performance
112112

@@ -355,6 +355,7 @@ object Matcher {
355355
// No Match
356356
case _ =>
357357
if (debug)
358+
val quotes = QuotesImpl()
358359
println(
359360
s""">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
360361
|Scrutinee

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2935,9 +2935,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
29352935
ctx1.gadt.addToConstraint(typeHoles)
29362936
ctx1
29372937

2938-
val qctx1 = QuotesImpl()(using ctx1)
2939-
2940-
val matcher = new Matcher.QuoteMatcher(qctx1)(using ctx1)
2938+
val matcher = new Matcher.QuoteMatcher(using ctx1)
29412939

29422940
val matchings =
29432941
if pat1.isType then matcher.termMatch(scrutinee, pat1)
@@ -2949,7 +2947,9 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
29492947
// After matching and doing all subtype checks, we have to approximate all the type bindings
29502948
// that we have found, seal them in a quoted.Type and add them to the result
29512949
def typeHoleApproximation(sym: Symbol) =
2952-
ctx1.gadt.approximation(sym, !sym.hasAnnotation(dotc.core.Symbols.defn.QuotedRuntimePatterns_fromAboveAnnot)).asInstanceOf[qctx1.reflect.TypeRepr].asType
2950+
val fromAboveAnnot = sym.hasAnnotation(dotc.core.Symbols.defn.QuotedRuntimePatterns_fromAboveAnnot)
2951+
val approx = ctx1.gadt.approximation(sym, !fromAboveAnnot)
2952+
reflect.TypeReprMethods.asType(approx)
29532953
matchings.map { tup =>
29542954
Tuple.fromIArray(typeHoles.map(typeHoleApproximation).toArray.asInstanceOf[IArray[Object]]) ++ tup
29552955
}

0 commit comments

Comments
 (0)