Implicit value can no longer be accessed via implicit conversion
See original GitHub issueCommunity build regression for https://github.com/giiita/refuel (maintainer @giiita) Based on Open Community Build #1884 Part of https://github.com/lampepfl/dotty/issues/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
Issue Analytics
- State:
- Created a year ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Can an implicit conversion of an implicit value satisfy an ...
Short answer: no. Scala's compiler will only ever look to apply a single implicit, so if it fails to spot an implicit int...
Read more >Implicit conversions - cppreference.com
This conversion initializes a temporary object of type T from the prvalue by evaluating the prvalue with the temporary object as its result...
Read more >Implicit Implications (part 2): Implicit Conversions - Rally Health
The best practice here is to never define implicit conversions on primitive or collection types.
Read more >Can't convert a function to a trait using an implicit conversion ...
It seems that the function needs to be fully specified to make the implicit conversion happen. Otherwise you get an 'missing parameter type' ......
Read more >Conversions - C# language specification - Microsoft Learn
Example: For instance, the conversion from type int to type long is implicit, so expressions of type int can implicitly be treated as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
First bad commit is db5956b36a7e62b77f4b3a9335ab1587e0e47e2c from #13886
Probably. It looks similar. We know for sure if it is the same commit that broke it.