Skip to content

Commit 22bc5e7

Browse files
committed
wip: don't approx at all when avoidFalseNegatives is false
1 parent f1674c5 commit 22bc5e7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -2131,13 +2131,15 @@ trait Applications extends Compatibility {
21312131
altType.widen match {
21322132
case tp: PolyType => resultConforms(altSym, tp.resultType, resultType, avoidFalseNegatives)
21332133
case tp: MethodType =>
2134-
val wildRes = wildApprox(tp.resultType)
2135-
21362134
class ResultApprox extends AvoidWildcardsMap:
21372135
// Prefer false negatives to false positives by approximating to a lower bound
21382136
variance = -1
21392137

2140-
val approx = if avoidFalseNegatives then ResultApprox()(wildRes) else wildRes
2138+
val approx =
2139+
if avoidFalseNegatives then
2140+
val wildRes = wildApprox(tp.resultType)
2141+
ResultApprox()(wildRes)
2142+
else tp.resultType
21412143
constrainResult(altSym, approx, resultType)
21422144
case _ => true
21432145
}

0 commit comments

Comments
 (0)