Skip to content

@static vals on Scala.js are not initialized #19441

Closed as not planned
Closed as not planned
@armanbilge

Description

@armanbilge

Compiler version

3.4.0-RC1-bin-20240112-c50f2ff-NIGHTLY

Minimized code

//> using scala 3.4.0-RC1-bin-20240112-c50f2ff-NIGHTLY
//> using platform js

import scala.annotation.static
class Foo
object Foo {
  @static val bar: String = "bar"

  @main def main() = println(bar)
}

Output

undefined

Expectation

bar

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions