Skip to content

Unit JS default param makes compiler crash with "Cannot hash a transient IR node" #15419

Closed
@armanbilge

Description

@armanbilge

Compiler version

3.2.0-RC1-bin-20220609-2836fbc-NIGHTLY

Minimized code

//> using scala "3.2.0-RC1-bin-20220609-2836fbc-NIGHTLY"
//> using platform "js"

package foo

import scala.scalajs.js

@js.native
trait Bar extends js.Object:
  protected[foo] def baz(
    dummy: Unit = js.native,
  ): Unit = js.native

def bar: Bar = ???

@main def main = bar.baz()

Output

Error: Unexpected error when compiling project_2c44eec9c4_2c44eec9c4-45290ff20c: 'Cannot hash a transient IR node (its value is of class class dotty.tools.backend.sjs.JSCodeGen$UndefinedParam$)'

Expectation

The same code compiles in Scala 2. Woops, I guess not. But the Scala 2 error says:

[error] ./bug.scala:15:1: Found a dangling UndefinedParam at Position(file:/workspace/sandbox/bug.scala,18,17). This is likely due to a bad interaction between a macro or a compiler plugin and the Scala.js compiler plugin. If you hit this, please let us know.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions