Skip to content

Trait parameters are not abstract when Scala.js inspects them #12621

Closed
@bishabosha

Description

@bishabosha

Compiler version

3.0.0

Minimized code

import scala.scalajs.js
import scala.scalajs.js.annotation.*

object A {

  @js.native
  trait Bag extends js.Any {
    val str: String
  }

  trait NonNativeBagHolderTrait(val bag: Bag) extends js.Any // error

}

Output

-- Error: tests/neg-scalajs/js-native-exports.scala:11:36 --------------------------------------------------------------
11 |  trait NonNativeBagHolderTrait(val bag: Bag) extends js.Any // error
                                ^^^^^^^^^^^^
       Members of non-native JS traits must either be abstract, or their right-hand-side must be `js.undefined`.

Expectation

no error, like if val bag: Bag is moved from trait params to the body

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions