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
using Scala (2.13.1) (reproduced in 2.13.2 and 2.12.11),
Welcome to Scala2.13.1 (OpenJDK64-BitServerVM, Java1.8.0_252).
Type in expressions for evaluation. Ortry:help.
scala>objectCrash {
|deflambdaList(lst: List[Int]):List[Int] = lst.collect { case n if n >0=> n }
| }
error:Errorwhile emitting <console>
assertion failed:
$read$Crash$$anonfun$lambdaList$1whilecompiling: <console>
during phase: jvm
library version: version 2.13.1
compiler version: version 2.13.1
reconstructed args: -deprecation -feature
last tree to typer: Ident(default)
tree position: line 2 of <console>
tree tpe: Function1symbol: value default
symbol definition: default: Function1 (a TermSymbol)
symbol package: $line3
symbol owners: value default -> method applyOrElse -><$anon: Function1>
call site: constructor $read$Crash$$anonfun$lambdaList$1 in package$line3==Source file context for tree position ==1objectCrash {
2deflambdaList(lst: List[Int]):List[Int] = lst.collect { case n if n >0=> n }
3 }
4
error:Errorwhile emitting Crash$
assertion failed: $read$Crash$$anonfun$lambdaList$1
problem
it shouldn't error when emitting. Somehow the combination of calling collect and a def that starts with lambda is necessary.
The text was updated successfully, but these errors were encountered:
➜ ✗ scala -Vdebug
scala> def lambdaList(lst: List[Int]): List[Int] = lst.collect { case n if n > 0 => n }
java.lang.AssertionError: assertion failed: $read$$iw$$anonfun$lambdaList$1
at scala.reflect.internal.SymbolTable.throwAssertionError(SymbolTable.scala:170)
at scala.tools.nsc.backend.jvm.BCodeHelpers.isAnonymousOrLocalClass(BCodeHelpers.scala:86)
where the code comment is
// if some outer name contains $lambda, a non-lambda class is considered lambda.
reproduction steps
repo with sbt build: https://github.com/snoble/scala-crash
scastie link: https://scastie.scala-lang.org/MywoibUzRSm0Sfb7jGjK8w
using Scala (2.13.1) (reproduced in 2.13.2 and 2.12.11),
problem
it shouldn't error when emitting. Somehow the combination of calling
collect
and adef
that starts withlambda
is necessary.The text was updated successfully, but these errors were encountered: