Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.13.0: ArrayStoreException in Vector.updated #11600

Open
rjmac opened this issue Jul 1, 2019 · 1 comment

Comments

Projects
None yet
5 participants
@rjmac
Copy link

commented Jul 1, 2019

This may be an instance of #7268 as it does not happen if the vector is not constructed via Vector.apply, but this particular manifestation is new in 2.13:

abstract class Base
class Derived1 extends Base
class Derived2 extends Base
val x = Vector(new Derived1)
x.updated(0, new Derived2) // exception in Vector.updateAt

If it matters, the JVM is openjdk 1.8.0_212

@NthPortal

This comment has been minimized.

Copy link

commented Jul 2, 2019

I believe the offending line is:

https://github.com/scala/scala/blob/26f34d022b9fc6af4a7231fd6bfc2e88a783de6d/src/library/scala/collection/immutable/Vector.scala#L33

it checks isInstanceOf[Array[AnyRef]], but forgets that Arrays are covariant at the JVM level. probably need a getClass check or something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.