sourcecode
sourcecode copied to clipboard
FullName does not work in `for` loops
Welcome to the Ammonite Repl 1.0.1
(Scala 2.12.3 Java 1.8.0_131)
If you like Ammonite, please support our development at www.patreon.com/lihaoyi
@ import $ivy.`com.lihaoyi::sourcecode:0.1.4`
import $ivy.$
@ def loop = {
for (i <- 0 until 1) {
println(implicitly[sourcecode.FullName])
}
}
defined function loop
@ loop
FullName(ammonite.$sess.cmd1.$anonfun)
The loop function should be present in FullName. Unfortunately it is not.
I noticed related but probably different misbehavior.
@ def test(): Unit = {
for {
_ <- Option(())
_ <- {
println(implicitly[sourcecode.FullName])
Option(())
}
} ()
}
defined function test
@ test
FullName(ammonite.$sess.cmd2)
It starts to work if the initial step is removed:
@ def test2(): Unit = {
for {
_ <- {
println(implicitly[sourcecode.FullName])
Option(())
}
} ()
}
defined function test2
@ test2
FullName(ammonite.$sess.cmd4.test2)