Skip to content

Commit f25c2a3

Browse files
committed
Use FunctionNOf.apply instead of FunctionOf.apply
1 parent 7028ca1 commit f25c2a3

File tree

3 files changed

+2
-13
lines changed

3 files changed

+2
-13
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ class CheckCaptures extends Recheck, SymTransformer:
410410
else if meth == defn.Caps_unsafeBoxFunArg then
411411
mapArgUsing:
412412
case defn.FunctionOf(paramtpe :: Nil, restpe, isContextual) =>
413-
defn.FunctionOf(paramtpe.forceBoxStatus(true) :: Nil, restpe, isContextual)
413+
defn.FunctionNOf(paramtpe.forceBoxStatus(true) :: Nil, restpe, isContextual)
414414

415415
else
416416
super.recheckApply(tree, pt) match

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,17 +1118,6 @@ class Definitions {
11181118
assert(ft.exists, s"not a valid function type: $mt")
11191119
ft
11201120

1121-
/** Create a `FunctionN`/`ContextFunctionN` type applied to the arguments and result type or a refined `PolyFunction`.
1122-
*
1123-
* `PolyFunction` is used if at least one of the arguments is annotated as erased.
1124-
*/
1125-
def apply(args: List[Type], resultType: Type, isContextual: Boolean = false)(using Context): Type =
1126-
val mt = MethodType.companion(isContextual, false)(args, resultType)
1127-
if mt.hasErasedParams then
1128-
RefinedType(PolyFunctionClass.typeRef, nme.apply, mt)
1129-
else
1130-
FunctionNOf(args, resultType, isContextual)
1131-
11321121
/** Matches a (possibly aliased) `FunctionN[...]`, `ContextFunctionN[...]` or refined `PolyFunction`.
11331122
* Extracts the list of function argument types, the result type and whether function is contextual.
11341123
* It only matches a `PolyFunction` if the function type is not result dependent.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2249,7 +2249,7 @@ trait Applications extends Compatibility {
22492249
false
22502250
val commonFormal =
22512251
if (isPartial) defn.PartialFunctionOf(commonParamTypes.head, WildcardType)
2252-
else defn.FunctionOf(commonParamTypes, WildcardType, isContextual = untpd.isContextualClosure(arg))
2252+
else defn.FunctionNOf(commonParamTypes, WildcardType, isContextual = untpd.isContextualClosure(arg))
22532253
overload.println(i"pretype arg $arg with expected type $commonFormal")
22542254
if (commonParamTypes.forall(isFullyDefined(_, ForceDegree.flipBottom)))
22552255
withMode(Mode.ImplicitsEnabled) {

0 commit comments

Comments
 (0)