Skip to content

Commit 748da85

Browse files
committed
Simplify minimize condition
1 parent 38135f3 commit 748da85

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,9 @@ object Inferencing {
108108
&& ctx.typerState.constraint.contains(tvar)
109109
&& {
110110
val direction = instDirection(tvar.origin)
111-
def avoidBottom =
112-
!force.allowBottom &&
113-
defn.isBottomType(ctx.typeComparer.approximation(tvar.origin, fromBelow = true))
114111
def preferMin =
115-
force.minimizeAll && (!avoidBottom || !tvar.hasUpperBound)
116-
|| variance >= 0 && !avoidBottom
112+
force.minimizeAll && (tvar.hasLowerBound || !tvar.hasUpperBound)
113+
|| variance >= 0 && (force.allowBottom || tvar.hasLowerBound)
117114
if (direction != 0) instantiate(tvar, direction < 0)
118115
else if (preferMin) instantiate(tvar, fromBelow = true)
119116
else toMaximize = true

0 commit comments

Comments
 (0)