Skip to content

Commit c58b23f

Browse files
committed
Fix adjust
Need to take into account type parameters that are not bound by constraint
1 parent 74d81ab commit c58b23f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,12 @@ trait ConstraintHandling[AbstractContext] {
109109
val p2 = adjust(tp.tp2)
110110
if p1.exists && p2.exists then tp.derivedAndOrType(p1, p2) else NoType
111111
case tp: TypeParamRef =>
112+
if constraint.contains(tp) then
113+
constr.println(i"${if tp eq param then "stripping" else "keeping"} $tp from $rawBound, upper = $isUpper in $constraint")
112114
if tp eq param then // (1)
113-
//println(i"stripping $tp from $rawBound, upper = $isUpper in $constraint")
114115
if isUpper then defn.AnyType else defn.NothingType
115116
else constraint.entry(tp) match // (3)
117+
case NoType => tp
116118
case TypeBounds(lo, hi) => if lo eq hi then adjust(lo) else tp
117119
case inst => adjust(inst)
118120
case tp: TypeVar => // (2)

0 commit comments

Comments
 (0)