Skip to content

Erasure: scala.Array survives erasure. #996

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

Closed
odersky opened this issue Dec 7, 2015 · 6 comments
Closed

Erasure: scala.Array survives erasure. #996

odersky opened this issue Dec 7, 2015 · 6 comments
Assignees

Comments

@odersky
Copy link
Contributor

odersky commented Dec 7, 2015

Compiling

./scala-scala/src/library/scala/collection/immutable/TrieIterator.scala

gives a crash in the backend. Everything -Ychecks OK before.

java.lang.AssertionError: assertion failed: class Array
at scala.Predef$.assert(Predef.scala:165)
at dotty.tools.backend.jvm.DottyBackendInterface$$anon$10.primitiveOrClassToBType$1(DottyBackendInterface.scala:814)
at dotty.tools.backend.jvm.DottyBackendInterface$$anon$10.toTypeKind(DottyBackendInterface.scala:835)
at scala.tools.nsc.backend.jvm.BCodeHelpers$BCInnerClassGen$class.toTypeKind(BCodeHelpers.scala:272)
at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.toTypeKind(BCodeSkelBuilder.scala:51)
at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.tpeTK(BCodeSkelBuilder.scala:84)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genTypeApply(BCodeBodyBuilder.scala:582)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:429)

@odersky
Copy link
Contributor Author

odersky commented Dec 7, 2015

You need to pull the updated dotty-library, otherwise the file is rejected by Typer.

@DarkDimius
Copy link
Contributor

@odersky, could you please help me reproduce the issue?
If I have dotty on c864e11 and library on lampepfl/scala@7f048c4

than I get error from typer:

./scala-scala/src/library/scala/collection/immutable/TrieIterator.scala:69: error: covariant type T occurs in invariant position in type Array[scala.collection.immutable.Iterable[T]] of value xs
  final class DupIterator(xs: Array[Iterable[T]]) extends TrieIterator[T](xs,
                            ^

@DarkDimius DarkDimius assigned odersky and unassigned DarkDimius Dec 16, 2015
@odersky
Copy link
Contributor Author

odersky commented Dec 20, 2015

@DarkDimius You need to compile with -language:Scala2. Then it passes the typer for me.

@odersky odersky assigned DarkDimius and unassigned odersky Dec 20, 2015
@DarkDimius
Copy link
Contributor

Was able to reproduce.

@DarkDimius DarkDimius changed the title Backend crash when compiling TrieIterator Erasure: scala.Array survives erasure. Dec 20, 2015
DarkDimius added a commit to dotty-staging/dotty that referenced this issue Dec 20, 2015
@DarkDimius
Copy link
Contributor

@odersky I traced this down to scala.Array surviving erasure.
I've improved post-condition in erasure to check this: #1005

@DarkDimius
Copy link
Contributor

fixed in #1005

DarkDimius added a commit to dotty-linker/dotty that referenced this issue May 9, 2016
OlivierBlanvillain pushed a commit to OlivierBlanvillain/dotty that referenced this issue Dec 8, 2016
OlivierBlanvillain pushed a commit to OlivierBlanvillain/dotty that referenced this issue Dec 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants