You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix widening logic to keep instantiation within bounds (#16417)
Before this commit, if `Config.checkConstraintsSatisfiable` was set to
`true`, then tests/pos/cls.scala would fail on `val b1` with:
Y is constrained to be >: Matchable but attempted to instantiate it to
Int | String
This happens because when `widenInferred` widens a union, it constrains
the upper-bound of the parameter being instantiated to be a subtype of
that union (`tpw <:< bound`). This is usually fine, but if
`isTransparent` is true, we'll return the original unwidened type, which
is now out of bounds.
To avoid this inconsistency, the `isTransparent` check is now moved
before the subtype check that updates the bounds.
0 commit comments