You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defg(x: =>Any):Any= x
vala:PartialFunction[Any=>Any, Any] = (f => g(f(0)) match { case v => v })
With dotty 0.27.0-RC1:
[info] Compiling 1 Scala source to /src/dotty-issues/i9391/target/scala-0.27/classes ...
java.util.NoSuchElementException: key not found: method $anonfun while traversing x
java.util.NoSuchElementException: key not found: method $anonfun while traversing x.apply
java.util.NoSuchElementException: key not found: method $anonfun while traversing x.apply(scala.Int.box(0))
java.util.NoSuchElementException: key not found: method $anonfun while traversing def $anonfun(): Object = x.apply(scala.Int.box(0))
java.util.NoSuchElementException: key not found: method $anonfun while traversing {
...
The trigger seems to be the by-name parameter to g, as this modified example illustrates:
defg(x: =>Any):Any= x
defh(x: Any):Any= x
//val a: PartialFunction[Any => Any, Any] = (f => g(f(0)) match { case v => v }) // errorvala:PartialFunction[Any=>Any, Any] = (f => h(f(0)) match { case v => v }) // OK
[info] Compiling 1 Scala source to /src/dotty-issues/i9391/target/scala-0.27/classes ...
[success] Total time: 2 s, completed Sep 19, 2020, 11:52:02 AM
In 0.26.0-bin-20200718-c753ca3-NIGHTLY and 0.25.0-RC2 this crashes the compiler:
It works in 2.11/2.12/2.13. Minimized from this real use case: https://github.com/slick/slick/blob/eecc74fa1ba8e477e6fbd991b5b9bbb87b8f3918/slick/src/main/scala/slick/jdbc/SQLiteProfile.scala#L136-L138
The text was updated successfully, but these errors were encountered: