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:
- Created a year ago
- Comments:6 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can reproduce this on all major Scala versions. Thank you for the report.
Ouch. I guess the scalac (and dotc) tree that comes right before that is
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.