question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unit JS default param makes compiler crash with "Found a dangling UndefinedParam"

See original GitHub issue
//> using scala "2.13.8"
//> using platform "js"

package foo

import scala.scalajs.js

@js.native
trait Bar extends js.Object {
  protected[foo] def baz(
    dummy: Unit = js.native,
  ): Unit = js.native
}

object App {

  def bar: Bar = ???

  def main = bar.baz()

}
[error] ./bug.scala:15:1: Found a dangling UndefinedParam at Position(file:/workspace/sandbox/bug.scala,18,17). 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.

Scala 3 sibling issue:

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
gzm0commented, Jun 11, 2022

I can reproduce this on all major Scala versions. Thank you for the report.

0reactions
sjrdcommented, Jun 11, 2022

Ouch. I guess the scalac (and dotc) tree that comes right before that is

val x$1: BoxedUnit$ = {
  qual$1.baz$default$1();
  BoxedUnit$.UNIT
}

We could recognize that shape and collapse it to a single <undefined-param>, but we might be too broad and get false positives with that. Then again, if we don’t catch that shape and it’s present, it is going to crash anyway instead, so perhaps that’s fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Announcing Scala.js 1.10.1
#4684 Unit JS default param makes compiler crash with “Found a dangling UndefinedParam”; #4675 ES2021 not supported in fullLinkJS.
Read more >
Prevent Error with Default {} when Destructuring
When you use destructuring, make sure to set a default value of empty {} to prevent it from throwing an error! function hi(person)...
Read more >
Javascript Functions and default parameters, not working in IE ...
Javascript does not allow a "default" specifier. A quick way of doing what you would want is changing: function saveItem(andClose = false) {...
Read more >
Why are Default Parameter Values Considered Bad in Scala?
The default value for url hides the true nature of what this method needs. The url parameter has been made optional because under...
Read more >
scala-js Recent Issues - IssueHint
Unit JS default param makes compiler crash with "Found a dangling UndefinedParam ", closed, 6, 2022-06-11, 2022-12-07. Improve `js.Promise` facade, closed, 8 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found