Thanks to visit codestin.com
Credit goes to github.com

Skip to content

New implicit unit conversions no longer work when importing more than one #239

@dziemba

Description

@dziemba

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions