Skip to content

Commit 6db3ba4

Browse files
committed
Support polyfunction args of polyfunctions
1 parent 390071e commit 6db3ba4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,13 @@ object TypeErasure {
209209
einfo
210210
case einfo =>
211211
// Erase the parameters of `apply` in subclasses of PolyFunction
212+
// Preserve PolyFunction argument types to support PolyFunctions with
213+
// PolyFunction arguments
212214
if (sym.is(TermParam) && sym.owner.name == nme.apply
213-
&& sym.owner.owner.derivesFrom(defn.PolyFunctionClass))
215+
&& sym.owner.owner.derivesFrom(defn.PolyFunctionClass)
216+
&& !(tp <:< defn.PolyFunctionType)) {
214217
defn.ObjectType
215-
else
218+
} else
216219
einfo
217220
}
218221
}

0 commit comments

Comments
 (0)