I was always figuring implicit conversions over multiple levels is not possible in scala (unless you define view bounds: http://docs.scala-lang.org/tutorials/FAQ/context-and
As Gabor already commented, this is due to numeric widening. If you run with the -print
option, you will see that a .toDouble
is appended to the i
, which then allows it to use the toA
implicit
. You can run scalac
with the warn-numeric-widen
and this will at least give you the following:
:14: warning: implicit numeric widening
println(i.total) //Why does this work?
^