Skip to content

Commit b91ad9b

Browse files
committed
no need in constrain type, if it already constrained
1 parent 23cc07f commit b91ad9b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4286,11 +4286,11 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
42864286
}
42874287

42884288
val pt1 = pt.deepenProtoTrans
4289-
tryConstrainType(pt1)
4289+
val isConstrained = tryConstrainType(pt1)
42904290
val arg = inferImplicitArg(formal, tree.span.endPos)
42914291
arg.tpe match
42924292
case failed: AmbiguousImplicits =>
4293-
if (pt1 `ne` pt) && (pt1 ne sharpenedPt) && constrainResult(tree.symbol, wtp, pt1)
4293+
if !isConstrained && (pt1 `ne` pt) && (pt1 ne sharpenedPt) && constrainResult(tree.symbol, wtp, pt1)
42944294
then implicitArgs(formals, argIndex, pt)
42954295
else arg :: implicitArgs(formals1, argIndex + 1, pt)
42964296
case failed: SearchFailureType =>

0 commit comments

Comments
 (0)