@@ -20,7 +20,7 @@ import typer.ErrorReporting._
20
20
import ast .Trees ._
21
21
import Applications ._
22
22
import TypeApplications ._
23
- import TypeUtils ._
23
+ import SymUtils . _ , core . NameOps ._
24
24
25
25
import dotty .tools .dotc .util .Positions .Position
26
26
import dotty .tools .dotc .core .Decorators ._
@@ -112,7 +112,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
112
112
def tupleSel (binder : Symbol )(i : Int ): Tree = ref(binder).select(nme.productAccessorName(i))
113
113
def index (tgt : Tree )(i : Int ): Tree = {
114
114
if (i > 0 ) tgt.select(defn.Seq_apply ).appliedTo(Literal (Constant (i)))
115
- else tgt.select(defn.Seq_head ).appliedIfMethod
115
+ else tgt.select(defn.Seq_head ).ensureApplied
116
116
}
117
117
118
118
// Right now this blindly calls drop on the result of the unapplySeq
@@ -237,7 +237,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
237
237
val matchFail = newSynthCaseLabel(ctx.freshName(" matchFail" ), MethodType (Nil , restpe))
238
238
val catchAllDefBody = DefDef (matchFail, catchAllDef)
239
239
240
- val nextCases = (caseSyms.tail ::: List (matchFail)).map(ref(_).appliedIfMethod )
240
+ val nextCases = (caseSyms.tail ::: List (matchFail)).map(ref(_).ensureApplied )
241
241
val caseDefs = (cases zip caseSyms zip nextCases).foldRight[Tree ](catchAllDefBody) {
242
242
// dotty deviation
243
243
// case (((mkCase, sym), nextCase), acc) =>
@@ -248,7 +248,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
248
248
249
249
val caseBody = DefDef (sym, _ => Block (List (acc), body))
250
250
251
- Block (List (caseBody),ref(sym).appliedIfMethod )
251
+ Block (List (caseBody),ref(sym).ensureApplied )
252
252
}}
253
253
254
254
@@ -278,7 +278,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
278
278
val isDefined = extractorMemberType(prev.tpe, nme.isDefined)
279
279
280
280
if ((isDefined isRef defn.BooleanClass ) && getTp.exists) {
281
- val prevValue = ref(prevSym).select(" get" .toTermName).appliedIfMethod
281
+ val prevValue = ref(prevSym).select(" get" .toTermName).ensureApplied
282
282
Block (
283
283
List (ValDef (prevSym, prev)),
284
284
// must be isEmpty and get as we don't control the target of the call (prev is an extractor call)
@@ -1800,7 +1800,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
1800
1800
if ((extractorMemberType(resultType, nme.isDefined) isRef defn.BooleanClass ) && resultOfGet.exists)
1801
1801
getUnapplySelectors(resultOfGet, args)
1802
1802
else if (defn.isProductSubType(resultType)) productSelectorTypes(resultType)
1803
- else if (resultType =:= defn.BooleanType ) Nil
1803
+ else if (resultType isRef defn.BooleanClass ) Nil
1804
1804
else {
1805
1805
ctx.error(i " invalid return type in Unapply node: $resultType" )
1806
1806
Nil
0 commit comments