Skip to content

Commit

Permalink
Handle poly functions in functionArgsInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
natsukagami committed Jan 13, 2023
1 parent ecb434d commit ce8a90b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/core/TypeApplications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 +506,11 @@ class TypeApplications(val self: Type) extends AnyVal {
case _ => Nil

/** If this is an encoding of a function type, return its arguments, otherwise return Nil.
* Handles ErasedFunctions gracefully.
* Handles `ErasedFunction`s and poly functions gracefully.
*/
final def functionArgInfos(using Context): List[Type] = self.dealias match
case RefinedType(parent, nme.apply, mt: MethodType) if defn.isErasedFunctionType(parent) => (mt.paramInfos :+ mt.resultType)
case RefinedType(parent, nme.apply, mt: MethodType) if parent.typeSymbol eq defn.PolyFunctionClass => (mt.paramInfos :+ mt.resultType)
case _ => self.dropDependentRefinement.dealias.argInfos

/** Argument types where existential types in arguments are disallowed */
Expand Down

0 comments on commit ce8a90b

Please sign in to comment.