Skip to content

Array.ofDim[Unit](0) throws IllegalArgumentException on Scala.js #22226

Closed
@armanbilge

Description

@armanbilge

Compiler version

3.6.4-RC1-bin-20241216-7dc5008-NIGHTLY

Minimized code

//> using scala 3.6.4-RC1-bin-20241216-7dc5008-NIGHTLY
//> using platform js

@main def main = Array.ofDim[Unit](0)

Output

/tmp/main12667871020961532039.js:1141
      throw e;
      ^

java.lang.IllegalArgumentException
    at $TypeData.newArray (/tmp/main12667871020961532039.js:851:11)
    at $p_jl_reflect_Array$__rec$1__jl_Class__I__AI__O (/tmp/main12667871020961532039.js:1085:39)
    at $c_jl_reflect_Array$.newInstance__jl_Class__AI__O (/tmp/main12667871020961532039.js:1121:10)
    at $c_Lbug$package$.main__Ajl_Void (/tmp/main12667871020961532039.js:982:52)
    at $s_Lmain__main__AT__V (/tmp/main12667871020961532039.js:1135:24)
    at Object.<anonymous> (/tmp/main12667871020961532039.js:2184:1)
    at Object.<anonymous> (/tmp/main12667871020961532039.js:2185:4)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Object..js (node:internal/modules/cjs/loader:1689:10)
    at Module.load (node:internal/modules/cjs/loader:1318:32) {
  jl_Throwable__f_s: null
}

Expectation

On the JVM it returns an array of scala.runtime.BoxedUnit.

Follow-up to scala-js/scala-js#5084.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions