Skip to content

Commit 1a8afbc

Browse files
committed
not constrainResult if type contains Wildcard Types
1 parent 116fdfc commit 1a8afbc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4268,11 +4268,12 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
42684268
)
42694269
case _ =>
42704270
mapOver(t)
4271+
val stripedApproxRes = tm(approxRes)
42714272
val resultAlreadyConstrained = pt1.isInstanceOf[MethodOrPoly]
4272-
if (!resultAlreadyConstrained) {
4273+
if (!resultAlreadyConstrained && !stripedApproxRes.containsWildcardTypes) {
42734274
if ctx.typerState.isCommittable then
4274-
NoViewsAllowed.constrainResult(tree.symbol, wtp.resultType, tm(approxRes))
4275-
else constrainResult(tree.symbol, wtp.resultType, tm(approxRes))
4275+
NoViewsAllowed.constrainResult(tree.symbol, wtp.resultType, stripedApproxRes)
4276+
else constrainResult(tree.symbol, wtp.resultType, stripedApproxRes)
42764277
}
42774278
}
42784279
}

0 commit comments

Comments
 (0)