Skip to content

Commit 3856aa1

Browse files
committed
Rename isNonRefinedFunction to isNonPolyFunction
1 parent 749b07c commit 3856aa1

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

compiler/src/dotty/tools/dotc/cc/CaptureSet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ object CaptureSet:
882882
++ (recur(rinfo.resType) // add capture set of result
883883
-- CaptureSet(rinfo.paramRefs.filter(_.isTracked)*)) // but disregard bound parameters
884884
case tpd @ AppliedType(tycon, args) =>
885-
if followResult && defn.isNonRefinedFunction(tpd) then
885+
if followResult && defn.isNonPolyFunction(tpd) then
886886
recur(args.last)
887887
// must be (pure) FunctionN type since ImpureFunctions have already
888888
// been eliminated in selector's dealias. Use capture set of result.

compiler/src/dotty/tools/dotc/cc/CheckCaptures.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ class CheckCaptures extends Recheck, SymTransformer:
708708
if eparent1 eq eparent then expected
709709
else CapturingType(eparent1, refs, boxed = expected0.isBoxed)
710710
case expected @ defn.FunctionOf(args, resultType, isContextual)
711-
if defn.isNonRefinedFunction(expected) && defn.isFunctionNType(actual) && !defn.isNonRefinedFunction(actual) =>
711+
if defn.isNonPolyFunction(expected) && defn.isFunctionNType(actual) && !defn.isNonPolyFunction(actual) =>
712712
val expected1 = toDepFun(args, resultType, isContextual)
713713
expected1
714714
case _ =>
@@ -842,7 +842,7 @@ class CheckCaptures extends Recheck, SymTransformer:
842842

843843
// Adapt the inner shape type: get the adapted shape type, and the capture set leaked during adaptation
844844
val (styp1, leaked) = styp match {
845-
case actual @ AppliedType(tycon, args) if defn.isNonRefinedFunction(actual) =>
845+
case actual @ AppliedType(tycon, args) if defn.isNonPolyFunction(actual) =>
846846
adaptFun(actual, args.init, args.last, expected, covariant, insertBox,
847847
(aargs1, ares1) => actual.derivedAppliedType(tycon, aargs1 :+ ares1))
848848
case actual @ RefinedType(_, _, rinfo: MethodType) if defn.isFunctionType(actual) =>

compiler/src/dotty/tools/dotc/cc/Setup.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ extends tpd.TreeTraverser:
4949
def recur(tp: Type): Type = tp.dealias match
5050
case tp @ CapturingType(parent, refs) if !tp.isBoxed =>
5151
tp.boxed
52-
case tp1 @ AppliedType(tycon, args) if defn.isNonRefinedFunction(tp1) =>
52+
case tp1 @ AppliedType(tycon, args) if defn.isNonPolyFunction(tp1) =>
5353
val res = args.last
5454
val boxedRes = recur(res)
5555
if boxedRes eq res then tp
@@ -129,7 +129,7 @@ extends tpd.TreeTraverser:
129129
apply(parent)
130130
case tp @ AppliedType(tycon, args) =>
131131
val tycon1 = this(tycon)
132-
if defn.isNonRefinedFunction(tp) then
132+
if defn.isNonPolyFunction(tp) then
133133
// Convert toplevel generic function types to dependent functions
134134
if !defn.isFunctionSymbol(tp.typeSymbol) && (tp.dealias ne tp) then
135135
// This type is a function after dealiasing, so we dealias and recurse.

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,7 @@ class Definitions {
17191719
/** Is `tp` (an alias) of either a scala.FunctionN or a scala.ContextFunctionN
17201720
* instance?
17211721
*/
1722-
def isNonRefinedFunction(tp: Type)(using Context): Boolean =
1722+
def isNonPolyFunction(tp: Type)(using Context): Boolean =
17231723
val arity = functionArity(tp)
17241724
val sym = tp.dealias.typeSymbol
17251725

@@ -1728,14 +1728,14 @@ class Definitions {
17281728
&& tp.isRef(
17291729
FunctionType(arity, sym.name.isContextFunction).typeSymbol,
17301730
skipRefined = false)
1731-
end isNonRefinedFunction
1731+
end isNonPolyFunction
17321732

17331733
/** Returns whether `tp` is an instance or a refined instance of:
17341734
* - scala.FunctionN
17351735
* - scala.ContextFunctionN
17361736
*/
17371737
def isFunctionNType(tp: Type)(using Context): Boolean =
1738-
isNonRefinedFunction(tp.dropDependentRefinement)
1738+
isNonPolyFunction(tp.dropDependentRefinement)
17391739

17401740
/** Returns whether `tp` is an instance or a refined instance of:
17411741
* - scala.FunctionN

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1509,7 +1509,7 @@ object Types {
15091509

15101510
/** Dealias, and if result is a dependent function type, drop the `apply` refinement. */
15111511
final def dropDependentRefinement(using Context): Type = dealias match {
1512-
case RefinedType(parent, nme.apply, mt) if defn.isNonRefinedFunction(parent) => parent
1512+
case RefinedType(parent, nme.apply, mt) if defn.isNonPolyFunction(parent) => parent
15131513
case tp => tp
15141514
}
15151515

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1894,7 +1894,7 @@ class Namer { typer: Typer =>
18941894
val approxTp = wildApprox(originalTp)
18951895
approxTp.stripPoly match
18961896
case atp @ defn.ContextFunctionType(_, resType, _)
1897-
if !defn.isNonRefinedFunction(atp) // in this case `resType` is lying, gives us only the non-dependent upper bound
1897+
if !defn.isNonPolyFunction(atp) // in this case `resType` is lying, gives us only the non-dependent upper bound
18981898
|| resType.existsPart(_.isInstanceOf[WildcardType], StopAt.Static, forceLazy = false) =>
18991899
originalTp
19001900
case _ =>

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,14 +1320,14 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
13201320
case tp: TypeParamRef =>
13211321
decomposeProtoFunction(ctx.typerState.constraint.entry(tp).bounds.hi, defaultArity, pos)
13221322
case _ => pt1.findFunctionType match {
1323-
case pt1 if defn.isNonRefinedFunction(pt1) =>
1323+
case pt1 if defn.isNonPolyFunction(pt1) =>
13241324
// if expected parameter type(s) are wildcards, approximate from below.
13251325
// if expected result type is a wildcard, approximate from above.
13261326
// this can type the greatest set of admissible closures.
13271327

13281328
(pt1.argInfos.init, typeTree(interpolateWildcards(pt1.argInfos.last.hiBound)))
13291329
case RefinedType(parent, nme.apply, mt @ MethodTpe(_, formals, restpe))
1330-
if defn.isNonRefinedFunction(parent) && formals.length == defaultArity =>
1330+
if defn.isNonPolyFunction(parent) && formals.length == defaultArity =>
13311331
(formals, untpd.InLambdaTypeTree(isResult = true, (_, syms) => restpe.substParams(mt, syms.map(_.termRef))))
13321332
case defn.PolyFunctionOf(mt @ MethodTpe(_, formals, restpe)) if formals.length == defaultArity =>
13331333
(formals, untpd.InLambdaTypeTree(isResult = true, (_, syms) => restpe.substParams(mt, syms.map(_.termRef))))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1801,7 +1801,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
18011801
def isDependentFunctionType: Boolean =
18021802
val tpNoRefinement = self.dropDependentRefinement
18031803
tpNoRefinement != self
1804-
&& dotc.core.Symbols.defn.isNonRefinedFunction(tpNoRefinement)
1804+
&& dotc.core.Symbols.defn.isNonPolyFunction(tpNoRefinement)
18051805
def isTupleN: Boolean =
18061806
dotc.core.Symbols.defn.isTupleNType(self)
18071807
def select(sym: Symbol): TypeRepr = self.select(sym)

0 commit comments

Comments
 (0)