Closed
Description
minimized code
trait Show[A] { def show(a: A): String = a.toString }
object Prefix {
type AbstractType
type UpperBoundedType <: String
type FullyBoundedType >: String <: String
given A as Show[AbstractType]
given B as Show[UpperBoundedType]
given C as Show[FullyBoundedType]
}
object App extends App {
println(s"implicit: ${implicitly[Show[Prefix.AbstractType]]}")
println(s"implicit: ${implicitly[Show[Prefix.UpperBoundedType]]}")
println(s"implicit: ${implicitly[Show[Prefix.FullyBoundedType]]}")
}
Scastie: https://scastie.scala-lang.org/otro4pYkQHiwGX9VPfUxaA
Compilation output
no implicit argument of type Show[Prefix.AbstractType] was found for parameter ev of method implicitly in object DottyPredef
no implicit argument of type Show[Prefix.UpperBoundedType] was found for parameter ev of method implicitly in object DottyPredef
no implicit argument of type Show[Prefix.FullyBoundedType] was found for parameter ev of method implicitly in object DottyPredef
expectation
Expected it to compile and work correctly, same as in Scala 2!
Scala 2 Scastie: https://scastie.scala-lang.org/I0odfeihTk2MdATPBDKlOg)
Output:
implicit: Prefix$A$@22b7f158
implicit: Prefix$B$@27bab57c
implicit: Prefix$C$@13df130b