New implicit unit conversions no longer work when importing more than one
dziemba opened this issue · comments
New Implicit unit conversions no longer work when importing more than one package in v18.12.0.
Expected behavior
When using the new implicit unit conversions (com.twitter.conversions.*Ops
), I expect to be able to use more than one conversion type, i.e. both StorageUnitOps
and DurationOps
Actual behavior
When importing more than one *Ops package, all conversions fail. It works fine when only importing a single package.
Steps to reproduce the behavior
import com.twitter.conversions.StorageUnitOps._
import com.twitter.conversions.DurationOps._
println(12.megabytes) // error: value megabytes is not a member of Int
println(4.seconds) // error: value seconds is not a member of Int
This used to work fine with the old conversions, which are deprecated as of v18.12.0:
import com.twitter.conversions.time._
import com.twitter.conversions.storage._
println(12.megabytes)
println(4.seconds)
It works again when renaming the imported classes:
import com.twitter.conversions.StorageUnitOps.{RichLong => A}
import com.twitter.conversions.DurationOps.{RichLong => B}
println(12.megabytes)
println(4.seconds)
interesting find, thanks!
this looks to be a limitation of the implicit classes using the same name. i this this is worth breaking the API to fix.
@dziemba I should get this patched today.
Landed it in 2d5d6da
Thanks for the great report.
Thanks for the quick fix!