File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -384,23 +384,20 @@ object QuotesAndSplices {
384
384
super .transform(tree)
385
385
end TreeMapWithVariance
386
386
387
- // TODO-18271: Seems we can use PolyProto instead?
388
387
object PolyFunctionOf {
389
388
/**
390
- * Return a poly-type + function type [$typeargs] => ($args) => ($resultType)
389
+ * Return a poly-type + method type [$typeargs] => ($args) => ($resultType)
391
390
* where typeargs occur in args and resulttype
392
- *
393
- * @param typeargs
394
- * @param args
395
- * @param resultType
396
- * @return
397
391
*/
398
392
def apply (typeargs : List [Type ], args : List [Type ], resultType : Type )(using Context ): Type =
399
393
val typeargs1 = PolyType .syntheticParamNames(typeargs.length)
400
- // TODO-18271 What would be good bounds?
401
- val paraminfosExp = (_ : PolyType ) => typeargs map (_ => TypeBounds .empty)
402
- // TODO-18271 Replace type args occurence in args with typeargs1?
403
- val resultTypeExp = (_ : PolyType ) => defn.FunctionOf (args, resultType)
394
+ val paraminfosExp = (_ : PolyType ) => typeargs map (_.bounds)
395
+ val resultTypeExp = (pt : PolyType ) => {
396
+ val fromSymbols = typeargs map (_.typeSymbol)
397
+ val args1 = args map (_.subst(fromSymbols, pt.paramRefs))
398
+ val resultType1 = resultType.subst(fromSymbols, pt.paramRefs)
399
+ MethodType (args1, resultType)
400
+ }
404
401
val tpe = PolyType (typeargs1)(paraminfosExp, resultTypeExp)
405
402
RefinedType (defn.PolyFunctionType , nme.apply, tpe)
406
403
}
You can’t perform that action at this time.
0 commit comments