File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -367,4 +367,25 @@ object QuotesAndSplices {
367
367
case _ =>
368
368
super .transform(tree)
369
369
end TreeMapWithVariance
370
+
371
+ // TODO-18271: Seems we can use PolyProto instead?
372
+ object PolyFunctionOf {
373
+ /**
374
+ * Return a poly-type + function type [$typeargs] => ($args) => ($resultType)
375
+ * where typeargs occur in args and resulttype
376
+ *
377
+ * @param typeargs
378
+ * @param args
379
+ * @param resultType
380
+ * @return
381
+ */
382
+ def apply (typeargs : List [Type ], args : List [Type ], resultType : Type )(using Context ): Type =
383
+ val typeargs1 = PolyType .syntheticParamNames(typeargs.length)
384
+ // TODO-18271 What would be good bounds?
385
+ val paraminfosExp = (_ : PolyType ) => typeargs map (_ => TypeBounds .empty)
386
+ // TODO-18271 Replace type args occurence in args with typeargs1?
387
+ val resultTypeExp = (_ : PolyType ) => defn.FunctionOf (args, resultType)
388
+ val tpe = PolyType (typeargs1)(paraminfosExp, resultTypeExp)
389
+ RefinedType (defn.PolyFunctionType , nme.apply, tpe)
390
+ }
370
391
}
You can’t perform that action at this time.
0 commit comments