@@ -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)
@@ -945,7 +945,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
945945
946946 def isVarPattern (pat : Tree ): Boolean = pat match {
947947 case x : BackquotedIdent => false
948- case x : Ident => nme.isVariableName( x.name)
948+ case x : Ident => x.name.isVariableName
949949 case _ => false
950950 }
951951
@@ -1391,7 +1391,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
13911391 val accessors =
13921392 if (defn.isProductSubType(binder.info))
13931393 productSelectors(binder.info)
1394- else binder.info. caseAccessors
1394+ else binder.caseAccessors
13951395 val res =
13961396 if (accessors.isDefinedAt(i - 1 )) ref(binder).select(accessors(i - 1 ).name)
13971397 else codegen.tupleSel(binder)(i) // this won't type check for case classes, as they do not inherit ProductN
@@ -1480,7 +1480,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
14801480 * when `binderKnownNonNull` is `true`, `ProductExtractorTreeMaker` does not do a (redundant) null check on binder
14811481 */
14821482 def treeMaker (binder : Symbol , binderKnownNonNull : Boolean , pos : Position , binderTypeTested : Type ): TreeMaker = {
1483- val paramAccessors = binder.info. caseAccessors
1483+ val paramAccessors = binder.caseAccessors
14841484 // binders corresponding to mutable fields should be stored (SI-5158, SI-6070)
14851485 // make an exception for classes under the scala package as they should be well-behaved,
14861486 // to optimize matching on List
@@ -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