Scala 2.13.10. Consider the following code:
object Hello extends App {
def foo(implicit i: Int) = println(i)
foo
implicit val i: Int = 42
foo
}
It compiles with the warning
Reference to uninitialized value i
[warn] foo
and prints
0
42
The expected behavior is that it compiles with an error of implicit not found.
Why does it behave the way it is?