Skip to content

Commit 97febd6

Browse files
committed
Remove defn.DependentFunctionRefinementOf
1 parent 9787c64 commit 97febd6

File tree

3 files changed

+5
-18
lines changed

3 files changed

+5
-18
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ class CheckCaptures extends Recheck, SymTransformer:
705705
else CapturingType(eparent1, refs, boxed = expected0.isBoxed)
706706
case defn.FunctionOf(mt: MethodType) =>
707707
actual match
708-
case defn.DependentFunctionRefinementOf(_) =>
708+
case defn.FunctionOf(mt2: MethodType) if mt2.isResultDependent =>
709709
mt.toFunctionType(isJava = false, alwaysDependent = true)
710710
case _ =>
711711
expected

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

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,8 +1123,9 @@ class Definitions {
11231123
*/
11241124
def unapply(ft: Type)(using Context): Option[MethodOrPoly] = {
11251125
ft match
1126-
case PolyFunctionOf(mt) => Some(mt)
1127-
case DependentFunctionRefinementOf(mt) => Some(mt)
1126+
case RefinedType(parent, nme.apply, mt: MethodOrPoly)
1127+
if parent.derivesFrom(defn.PolyFunctionClass) || (isFunctionNType(parent) && mt.isResultDependent) =>
1128+
Some(mt)
11281129
case FunctionNOf(argTypes, resultType, isContextual) =>
11291130
val methodType = if isContextual then ContextualMethodType else MethodType
11301131
Some(methodType(argTypes, resultType))
@@ -1180,20 +1181,6 @@ class Definitions {
11801181
case _ => isValidMethodType(info)
11811182
}
11821183

1183-
object DependentFunctionRefinementOf {
1184-
/** Matches a dependent refinement of `FunctionN[...]` or `ContextFunctionN[...]` type.
1185-
* Extracts the method type type and apply info.
1186-
*
1187-
* Pattern: `(FunctionN | ContextFunction|) { def apply: $mt }`
1188-
*/
1189-
def unapply(tpe: RefinedType)(using Context): Option[MethodType] =
1190-
tpe.refinedInfo match
1191-
case mt: MethodType
1192-
if tpe.refinedName == nme.apply && isFunctionNType(tpe.parent) && mt.isResultDependent =>
1193-
Some(mt)
1194-
case _ => None
1195-
}
1196-
11971184
object PartialFunctionOf {
11981185
def apply(arg: Type, result: Type)(using Context): Type =
11991186
PartialFunctionClass.typeRef.appliedTo(arg :: result :: Nil)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1800,7 +1800,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
18001800
case _ => false
18011801
def isDependentFunctionType: Boolean =
18021802
self match
1803-
case dotc.core.Symbols.defn.DependentFunctionRefinementOf(_) => true
1803+
case dotc.core.Symbols.defn.FunctionOf(mt) => mt.isResultDependent
18041804
case _ => false
18051805
def isTupleN: Boolean =
18061806
dotc.core.Symbols.defn.isTupleNType(self)

0 commit comments

Comments
 (0)