Skip to content

Incorrect warning about ambiguous implicit #20572

@OlegYch

Description

@OlegYch

Compiler version

3.5.0-RC1-3.5.1-RC1-bin-20240613-61a15b2-NIGHTLY

Minimized code

can't really minimize, but i hope the error message is enough
here is an approximation but for some reason it doesn't produce a warning:
https://scastie.scala-lang.org/OlegYch/io8Z28sZTC2qIUA3lqJtSw/36

Output

instead i get a warning:

[warn] 124 | "metal" -> Money[CurrencyCode.Any](1, CurrencyCode.Gold), [warn] | ^ [warn] |Given search preference for play.api.libs.json.Writes[com.Money[com.CurrencyCode.CurrencyValue]] between alternatives (com.Money._MoneyFormat : [warn] | [C <: com.CurrencyCode.Any] [warn] | (implicit evidence$1: play.api.libs.json.Format[C]): play.api.libs.json.Format[com.Money[C]] [warn] |) and (play.api.libs.json.Writes.enumNameWrites : [warn] | [E <: Enumeration](using e: ValueOf[E]): play.api.libs.json.Writes[e.value.Value]) will change [warn] |Current choice : the first alternative [warn] |New choice from Scala 3.6: none - it's ambiguous 

for some reason it tries to apply enumNameWrites from play, but it's only applicable for scala.Enumeration, not enumeratum

Expectation

no warning

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:implicitsrelated to implicitsarea:reportingError reporting including formatting, implicit suggestions, etcitype:bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions