@@ -998,11 +998,10 @@ class Definitions {
998998 FunctionType (args.length, isContextual, isErased).appliedTo(args ::: resultType :: Nil )
999999 def unapply (ft : Type )(using Context ): Option [(List [Type ], Type , Boolean , Boolean )] = {
10001000 val tsym = ft.typeSymbol
1001- if ( isFunctionClass(tsym)) {
1001+ if isFunctionClass(tsym) && ft.isRef(tsym) then
10021002 val targs = ft.dealias.argInfos
10031003 if (targs.isEmpty) None
10041004 else Some (targs.init, targs.last, tsym.name.isContextFunction, tsym.name.isErasedFunction)
1005- }
10061005 else None
10071006 }
10081007 }
@@ -1379,15 +1378,16 @@ class Definitions {
13791378 /** Is `tp` (an alias) of either a scala.FunctionN or a scala.ContextFunctionN
13801379 * instance?
13811380 */
1382- def isNonRefinedFunction (tp : Type )(using Context ): Boolean = {
1381+ def isNonRefinedFunction (tp : Type )(using Context ): Boolean =
13831382 val arity = functionArity(tp)
13841383 val sym = tp.dealias.typeSymbol
13851384
1386- arity >= 0 &&
1387- isFunctionClass(sym) &&
1388- tp.isRef(FunctionType (arity, sym.name.isContextFunction, sym.name.isErasedFunction).typeSymbol) &&
1389- ! tp.isInstanceOf [RefinedType ]
1390- }
1385+ arity >= 0
1386+ && isFunctionClass(sym)
1387+ && tp.isRef(
1388+ FunctionType (arity, sym.name.isContextFunction, sym.name.isErasedFunction).typeSymbol,
1389+ skipRefined = false )
1390+ end isNonRefinedFunction
13911391
13921392 /** Is `tp` a representation of a (possibly dependent) function type or an alias of such? */
13931393 def isFunctionType (tp : Type )(using Context ): Boolean =
@@ -1460,9 +1460,9 @@ class Definitions {
14601460 if ctx.erasedTypes then
14611461 atPhase(erasurePhase)(unapply(tp))
14621462 else
1463- val tp1 = tp.dealias
1464- if isContextFunctionClass( tp1.typeSymbol) then
1465- val args = asContextFunctionType(tp) .dropDependentRefinement.argInfos
1463+ val tp1 = asContextFunctionType(tp)
1464+ if tp1.exists then
1465+ val args = tp1 .dropDependentRefinement.argInfos
14661466 Some ((args.init, args.last, tp1.typeSymbol.name.isErasedFunction))
14671467 else None
14681468
0 commit comments