Skip to content

Commit db7a8b1

Browse files
nicolasstuckiKordyjan
authored andcommitted
Rename isRefinedFunctionType to isPolyOrErasedFunctionType
[Cherry-picked 96af363]
1 parent b429ce7 commit db7a8b1

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

compiler/src/dotty/tools/dotc/ast/TreeInfo.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
961961
&& tree.isTerm
962962
&& {
963963
val qualType = tree.qualifier.tpe
964-
hasRefinement(qualType) && !defn.isRefinedFunctionType(qualType)
964+
hasRefinement(qualType) && !defn.isPolyOrErasedFunctionType(qualType)
965965
}
966966
def loop(tree: Tree): Boolean = tree match
967967
case TypeApply(fun, _) =>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,7 +1705,7 @@ class Definitions {
17051705
isNonRefinedFunction(tp.dropDependentRefinement)
17061706

17071707
/** Is `tp` a specialized, refined function type? Either an `ErasedFunction` or a `PolyFunction`. */
1708-
def isRefinedFunctionType(tp: Type)(using Context): Boolean =
1708+
def isPolyOrErasedFunctionType(tp: Type)(using Context): Boolean =
17091709
isPolyFunctionType(tp) || isErasedFunctionType(tp)
17101710

17111711
/** Is `tp` a specialized, refined `PolyFunction` type? */
@@ -1723,7 +1723,7 @@ class Definitions {
17231723
* - PolyFunction
17241724
*/
17251725
def isFunctionType(tp: Type)(using Context): Boolean =
1726-
isFunctionNType(tp) || isRefinedFunctionType(tp)
1726+
isFunctionNType(tp) || isPolyOrErasedFunctionType(tp)
17271727

17281728
private def withSpecMethods(cls: ClassSymbol, bases: List[Name], paramTypes: Set[TypeRef]) =
17291729
for base <- bases; tp <- paramTypes do

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ class TypeApplications(val self: Type) extends AnyVal {
509509
* Handles `ErasedFunction`s and poly functions gracefully.
510510
*/
511511
final def functionArgInfos(using Context): List[Type] = self.dealias match
512-
case RefinedType(parent, nme.apply, mt: MethodType) if defn.isRefinedFunctionType(parent) => (mt.paramInfos :+ mt.resultType)
512+
case RefinedType(parent, nme.apply, mt: MethodType) if defn.isPolyOrErasedFunctionType(parent) => (mt.paramInfos :+ mt.resultType)
513513
case _ => self.dropDependentRefinement.dealias.argInfos
514514

515515
/** Argument types where existential types in arguments are disallowed */

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ class TypeErasure(sourceLanguage: SourceLanguage, semiEraseVCs: Boolean, isConst
654654
else SuperType(eThis, eSuper)
655655
case ExprType(rt) =>
656656
defn.FunctionType(0)
657-
case RefinedType(parent, nme.apply, refinedInfo) if defn.isRefinedFunctionType(parent) =>
657+
case RefinedType(parent, nme.apply, refinedInfo) if defn.isPolyOrErasedFunctionType(parent) =>
658658
eraseRefinedFunctionApply(refinedInfo)
659659
case tp: TypeVar if !tp.isInstantiated =>
660660
assert(inSigName, i"Cannot erase uninstantiated type variable $tp")
@@ -936,7 +936,7 @@ class TypeErasure(sourceLanguage: SourceLanguage, semiEraseVCs: Boolean, isConst
936936
sigName(defn.FunctionOf(Nil, rt))
937937
case tp: TypeVar if !tp.isInstantiated =>
938938
tpnme.Uninstantiated
939-
case tp @ RefinedType(parent, nme.apply, _) if defn.isRefinedFunctionType(parent) =>
939+
case tp @ RefinedType(parent, nme.apply, _) if defn.isPolyOrErasedFunctionType(parent) =>
940940
// we need this case rather than falling through to the default
941941
// because RefinedTypes <: TypeProxy and it would be caught by
942942
// the case immediately below

compiler/src/dotty/tools/dotc/transform/Erasure.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ object Erasure {
677677
// Instead, we manually lookup the type of `apply` in the qualifier.
678678
inContext(preErasureCtx) {
679679
val qualTp = tree.qualifier.typeOpt.widen
680-
if defn.isRefinedFunctionType(qualTp) then
680+
if defn.isPolyOrErasedFunctionType(qualTp) then
681681
eraseRefinedFunctionApply(qualTp.select(nme.apply).widen).classSymbol
682682
else
683683
NoSymbol

compiler/src/dotty/tools/dotc/transform/TreeChecker.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ object TreeChecker {
446446
val tpe = tree.typeOpt
447447

448448
// PolyFunction and ErasedFunction apply methods stay structural until Erasure
449-
val isRefinedFunctionApply = (tree.name eq nme.apply) && defn.isRefinedFunctionType(tree.qualifier.typeOpt)
449+
val isRefinedFunctionApply = (tree.name eq nme.apply) && defn.isPolyOrErasedFunctionType(tree.qualifier.typeOpt)
450450
// Outer selects are pickled specially so don't require a symbol
451451
val isOuterSelect = tree.name.is(OuterSelectName)
452452
val isPrimitiveArrayOp = ctx.erasedTypes && nme.isPrimitiveName(tree.name)

0 commit comments

Comments
 (0)