Skip to content

Implicit value can no longer be accessed via implicit conversion #15670

Closed
@WojciechMazur

Description

@WojciechMazur

Community build regression for https://github.com/giiita/refuel (maintainer @giiita)
Based on Open Community Build #1884
Part of #15647 regressions tracker

Compiler version

Works in 3.1.1
Fails in 3.1.2 and 3.1.3
Fails in 3.2.0-RC* and 3.2.1-RC1-bin-20220711-6efd92d-NIGHTLY

Minimized code

trait JsonRowEntry {
  def readAs[E](implicit c: Read[E]): Option[E] = ???
}
trait Read[T]
trait Codec[T] extends Read[T]
trait CodecTypeProjection[C[_]]
object JsonTransform  {
  given SetCodec[T, C[_]: CodecTypeProjection]: scala.Conversion[C[T], C[Set[T]]] = ???
  given SetCodecExp[T, C[_]: CodecTypeProjection](using codec: C[T]): C[Set[T]] = codec
  given Codec[String] = ???
  given CodecTypeProjection[Read] = ???
}

@main def Test() = {
  import JsonTransform.given
  val tree = new JsonRowEntry {}
  tree.readAs[Set[String]]
}

Output

rror] ./test.scala:17:27: No given instance of type Read[Set[String]] was found for parameter c of method readAs in trait JsonRowEntry.
[error] I found:
[error] 
[error]     JsonTransform.SetCodecExp[String, C](
[error]       JsonTransform.given_CodecTypeProjection_Read
[error]     , /* missing */summon[C[String]])
[error] 
[error] But no implicit values were found that match type C[String].
[error]   tree.readAs[Set[String]]
[error]              

Expectation

Should be able to find correct implicit value by usage of implicit conversion

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions