Scala view application puzzler

前端 未结 5 1654
粉色の甜心
粉色の甜心 2021-02-04 09:20

Say we have the following two traits:

trait Foo[A] { def howMany(xs: List[A]) = xs.size }
trait Bar

And an implicit conversion from the second

5条回答
  •  情话喂你
    2021-02-04 09:56

    For everyone's reference, this could only be a bug. The way you know that is the error message:

    :13: error: type mismatch;
     found   : List[Int]
     required: List[A]
    

    List[A] is not a real type - it is List applied to its own type parameter. That is not a type which can be required since it is not a type which can be expressed.

    [Edit - it's too early, who knows what I'm talking about. Ignore the above, but you can still follow the link.]

    The relevant ticket for this is https://issues.scala-lang.org/browse/SI-6472 .

提交回复
热议问题