Skip to content

ScalaJs: Found a dangling UndefinedParam at Position #477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tracked by #553
fdietze opened this issue Dec 12, 2021 · 3 comments
Closed
Tracked by #553

ScalaJs: Found a dangling UndefinedParam at Position #477

fdietze opened this issue Dec 12, 2021 · 3 comments

Comments

@fdietze
Copy link

fdietze commented Dec 12, 2021

I just added the scoverage plugin to a scalajs project and it fails with the following error:

[error] /home/runner/work/outwatch/outwatch/util/src/main/scala/outwatch/util/WebSocket.scala:13:18: Found a dangling UndefinedParam at Position(...).
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.
[error] final case class WebSocket private(url: String) {
[error]                  ^
[error] one error found

https://github.com/outwatch/outwatch/runs/4499199813?check_suite_focus=true#step:7:219

PR: outwatch/outwatch#553

@mprevel
Copy link

mprevel commented Dec 17, 2021

Hi @fdietze

I've just encountered the issue a few hours ago.
It happens when a function (probably js native) has multiple parameters and some of them are not set.
It should be valid especially when these parameters are optional in the js function, but it breaks the coverage.

For example : JSON.parse("{}") should be valid but will fail. To make it work you'll have to provide the second parameter that is a function that transforms the value so you have to write JSON.parse("{}", (key, value) => value).
another example : element.addEventListener("mouseup", someCallback) will not work without the useCapture` parameter set.

Sometimes adding an extra parameter keeps the same behaviors, sometimes not. It may also have an impact on performance.

I hope this issue could be fixed since this is very common.

@ckipp01
Copy link
Member

ckipp01 commented Jun 28, 2022

There is a chance that this has been fixed with some recent changes like #466. Are you able to test this again with the latest version to see if your issue is fixed? I'll move this over to the main repo since they fix would actually be there.

@ckipp01 ckipp01 transferred this issue from scoverage/sbt-scoverage Jun 28, 2022
@fdietze
Copy link
Author

fdietze commented Sep 30, 2022

Looks like it's working now, thank you!

@fdietze fdietze closed this as completed Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants