Open
Description
minimized code
class Named[S <: String with Singleton](s: S)
object Named {
given Conversion[(s: String), Named[s.type]] {
def apply(s: String): Named[s.type] = new Named(s)
}
// this is ok:
// implicit def convert(s: String): Named[s.type] = new Named[s.type](s)
"abc": Named["abc"]
}
expectation
Expected being able to define an instance of Conversion
equivalent to implicit def convert(s: String): Named[s.type]
. However the definition above fails to parse!
[error] example.scala:22:20: an identifier expected, but '(' found
[error] given Conversion[(s: String), Named[s.type]] {
[error] ^
[error] example.scala:28:3: Found: String("abc")
[error] Required: Named[String("abc")]
[error] "abc": Named["abc"]
[error] ^
[error] two errors found