File tree 1 file changed +21
-0
lines changed
compiler/src/dotty/tools/dotc/typer
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -383,4 +383,25 @@ object QuotesAndSplices {
383
383
case _ =>
384
384
super .transform(tree)
385
385
end TreeMapWithVariance
386
+
387
+ // TODO-18271: Seems we can use PolyProto instead?
388
+ object PolyFunctionOf {
389
+ /**
390
+ * Return a poly-type + function type [$typeargs] => ($args) => ($resultType)
391
+ * where typeargs occur in args and resulttype
392
+ *
393
+ * @param typeargs
394
+ * @param args
395
+ * @param resultType
396
+ * @return
397
+ */
398
+ def apply (typeargs : List [Type ], args : List [Type ], resultType : Type )(using Context ): Type =
399
+ 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)
404
+ val tpe = PolyType (typeargs1)(paraminfosExp, resultTypeExp)
405
+ RefinedType (defn.PolyFunctionType , nme.apply, tpe)
406
+ }
386
407
}
You can’t perform that action at this time.
0 commit comments