Skip to content

simplified vararg example error #11419

Closed
@kpbochenek

Description

@kpbochenek

Compiler version

3.0.0-M4-bin-20210214-80befc3-NIGHTLY

Minimized code

(from docs on unified varargs syntax)

    val arr = Array(1, 2, 3)
    val lst = List(0, arr*)                  // vararg splice argument
    lst match {
      case List(0, 1, xs*) => println(xs)   // binds xs to Seq(2, 3)
      case List(1, _*) =>                   // wildcard pattern
    }

Output (click arrow to expand)

[error] (run-main-0) java.lang.ClassCastException: [I cannot be cast to scala.collection.immutable.Seq
[error] java.lang.ClassCastException: [I cannot be cast to scala.collection.immutable.Seq
[error] 	at Main$.main(Main.scala:8)
[error] 	at Main.main(Main.scala)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] 	at java.lang.reflect.Method.invoke(Method.java:498)

It is simple main with code above. Also tried in dotty REPL built from master - same exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions