Skip to content

Compiler rejects native default constructor parameters when compiling Scala.js native classes #11592

Closed
@russwyte

Description

@russwyte

3.0.0-RC1

Minimized code

@js.native
@JSGlobal
class SharedWorker(stringUrl: String, name: js.UndefOr[String] = js.native)
    extends webworkers.AbstractWorker {
  def port: MessagePort = js.native
}

Output

[info] compiling 53 Scala sources to /Users/rwhite/projects/scala-js-dom/target/scala-3.0.0-RC1/classes ...
[error] -- Error: /Users/rwhite/projects/scala-js-dom/src/main/scala/org/scalajs/dom/experimental/sharedworkers/SharedWorker.scala:33:65 
[error] 33 |class SharedWorker(stringUrl: String, name: js.UndefOr[String] = js.native)
[error]    |                                                                 ^^^^^^^^^
[error]    |       js.native may only be used as stub implementation in facade types
[error] one error [found](url)
[error] one error found
[error] (Compile / compileIncremental) Compilation failed

Expectation

This should compile without error.

See [https://github.com/scala-js/scala-js-dom/pull/446]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions