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
Fixscala#5140: Ycheck failure in covariant java varargs
Allow passing `Array[Dog]` to a Java varargs that expects an
`Array[Animal]`. This types because Java vargs are represented as
`RepeatedParam[+T]`, which is covariant.
However, after `elimRepeated`, the `RP`s go away and the true type
(Array) is revealed, which was causing a Ycheck error because arrays are
invariant before erasure.
Fix the Ycheck error by casting `Array[Dog]` to `Array[Animal]`. This is
unsound but consistent with the typer behaviour and what scalac does.
0 commit comments