Skip to content

Commit c732a22

Browse files
committed
Refactor decomposeProtoFunction
1 parent 320fb67 commit c732a22

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,18 +1321,18 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
13211321
case tp: TypeParamRef =>
13221322
decomposeProtoFunction(ctx.typerState.constraint.entry(tp).bounds.hi, defaultArity, pos)
13231323
case _ => pt1.findFunctionType match {
1324-
case ft @ defn.PolyFunctionOf(mt @ MethodTpe(_, formals, restpe)) =>
1325-
if formals.length != defaultArity then fallbackProto
1326-
else (formals, untpd.InLambdaTypeTree(isResult = true, (_, syms) => restpe.substParams(mt, syms.map(_.termRef))))
1327-
case ft @ defn.DependentFunctionRefinementOf(_, mt @ MethodTpe(_, formals, restpe)) =>
1328-
if formals.length != defaultArity then fallbackProto
1329-
else (formals, untpd.InLambdaTypeTree(isResult = true, (_, syms) => restpe.substParams(mt, syms.map(_.termRef))))
13301324
case ft @ defn.FunctionNOf(_, _, _) =>
13311325
// if expected parameter type(s) are wildcards, approximate from below.
13321326
// if expected result type is a wildcard, approximate from above.
13331327
// this can type the greatest set of admissible closures.
13341328

13351329
(ft.argInfos.init, typeTree(interpolateWildcards(ft.argInfos.last.hiBound)))
1330+
case ft @ defn.PolyFunctionOf(mt @ MethodTpe(_, formals, restpe)) =>
1331+
if formals.length != defaultArity then fallbackProto
1332+
else (formals, untpd.InLambdaTypeTree(isResult = true, (_, syms) => restpe.substParams(mt, syms.map(_.termRef))))
1333+
case ft @ defn.DependentFunctionRefinementOf(_, mt @ MethodTpe(_, formals, restpe)) =>
1334+
if formals.length != defaultArity then fallbackProto
1335+
else (formals, untpd.InLambdaTypeTree(isResult = true, (_, syms) => restpe.substParams(mt, syms.map(_.termRef))))
13361336
case SAMType(mt @ MethodTpe(_, formals, _), samParent) =>
13371337
val restpe = mt.resultType match
13381338
case mt: MethodType => mt.toFunctionType(isJava = samParent.classSymbol.is(JavaDefined))

0 commit comments

Comments
 (0)