Skip to content

Compiler crash with a dash in a parameter of a lambda #1790

@mrerrormessage

Description

@mrerrormessage

I have run into a curious bug, which I have attempted to minimize in this github project. It occurs when using macros with a dashy identifier. The macros work fine when compiled with stock scala, but they error when compiled with scala-js. The exception begins:

java.lang.IllegalArgumentException: requirement failed: a-b is not a valid identifier
        at scala.Predef$.require(Predef.scala:219)
        at org.scalajs.core.ir.Trees$.requireValidIdent(Trees.scala:61)
        at org.scalajs.core.ir.Trees$Ident.<init>(Trees.scala:45)
        at org.scalajs.core.compiler.JSEncoding$class.freshLocalIdent(JSEncoding.scala:71)
        at org.scalajs.core.compiler.GenJSCode.freshLocalIdent(GenJSCode.scala:31)
        at org.scalajs.core.compiler.GenJSCode$JSCodePhase$$anonfun$78.apply(GenJSCode.scala:3864)
        at org.scalajs.core.compiler.GenJSCode$JSCodePhase$$anonfun$78.apply(GenJSCode.scala:3858)
        at scala.collection.TraversableLike$WithFilter$$anonfun$map$2.apply(TraversableLike.scala:728)
        at scala.collection.immutable.List.foreach(List.scala:381)
        at scala.collection.TraversableLike$WithFilter.map(TraversableLike.scala:727)

I would be happy to contribute if there's anything I can do to help fix the issue, but I'm not sure where to start.

Metadata

Metadata

Assignees

Labels

bugConfirmed bug. Needs to be fixed.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions