IndexOutOfBoundsException coming from TypeMaps #9253
Labels
compiler crash
fixed in Scala 3
This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)
Milestone
Here is some code that crashes the compiler. Reproducible by pasting into a REPL running 2.11.6.
I expect this code to fail with a compile error, informing me that there is a discrepancy between type params of
One
.What seems to be happening, is that the compiler derives an index in order to dereference a list of type parameters. The type
One
in traitBar
has no params, but the classOne
does! The compiler derives the index0
, and then derefs an empty list of params - IndexOutOfBoundsException.Note 1: If
def makeOne: One
is moved into traitFoo
, the compiler doesn't crash.Note 2: If
def makeUnit
doesn't take a parameter of typeXYZ
(keeping class One parameterized onXYZ
), the compiler also doesn't crash. For example,and
both do not crash the compiler.
I looked through the open issues, and the stack trace this produces (pasted below) is extremely similar to the trace shown in issue #8745. (That issue is marked as a duplicate of #8439.) Since those tickets depend on swing-scala, I opted to open a new ticket, since it wasn't clear that this issue was the only issue present in those tickets.
The text was updated successfully, but these errors were encountered: