@@ -20,7 +20,7 @@ import typer.ErrorReporting._
2020import ast .Trees ._
2121import Applications ._
2222import TypeApplications ._
23- import TypeUtils ._
23+ import SymUtils . _ , core . NameOps ._
2424
2525import dotty .tools .dotc .util .Positions .Position
2626import dotty .tools .dotc .core .Decorators ._
@@ -112,7 +112,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
112112 def tupleSel (binder : Symbol )(i : Int ): Tree = ref(binder).select(nme.productAccessorName(i))
113113 def index (tgt : Tree )(i : Int ): Tree = {
114114 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
116116 }
117117
118118 // Right now this blindly calls drop on the result of the unapplySeq
@@ -237,7 +237,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
237237 val matchFail = newSynthCaseLabel(ctx.freshName(" matchFail" ), MethodType (Nil , restpe))
238238 val catchAllDefBody = DefDef (matchFail, catchAllDef)
239239
240- val nextCases = (caseSyms.tail ::: List (matchFail)).map(ref(_).appliedIfMethod )
240+ val nextCases = (caseSyms.tail ::: List (matchFail)).map(ref(_).ensureApplied )
241241 val caseDefs = (cases zip caseSyms zip nextCases).foldRight[Tree ](catchAllDefBody) {
242242 // dotty deviation
243243 // case (((mkCase, sym), nextCase), acc) =>
@@ -248,7 +248,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
248248
249249 val caseBody = DefDef (sym, _ => Block (List (acc), body))
250250
251- Block (List (caseBody),ref(sym).appliedIfMethod )
251+ Block (List (caseBody),ref(sym).ensureApplied )
252252 }}
253253
254254
@@ -278,7 +278,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
278278 val isDefined = extractorMemberType(prev.tpe, nme.isDefined)
279279
280280 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
282282 Block (
283283 List (ValDef (prevSym, prev)),
284284 // 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
18001800 if ((extractorMemberType(resultType, nme.isDefined) isRef defn.BooleanClass ) && resultOfGet.exists)
18011801 getUnapplySelectors(resultOfGet, args)
18021802 else if (defn.isProductSubType(resultType)) productSelectorTypes(resultType)
1803- else if (resultType =:= defn.BooleanType ) Nil
1803+ else if (resultType isRef defn.BooleanClass ) Nil
18041804 else {
18051805 ctx.error(i " invalid return type in Unapply node: $resultType" )
18061806 Nil
0 commit comments