Open virusdave opened 7 years ago
Any thoughts on this?
There are a lot of existential types in this example that make me feel uneasy (there's even a warning about them). Which naturally leads to the following definition that does work:
def pairItBad[L <: FlatShapeLevel, A, B, C](q: Query[A, B])(implicit shape: Shape[L, A, B, C]) =
q.map(x => (x, x))
Note: Dotty doesn't have existential types (only wildcards).
@joroKr21 Has this issue between existential types and implicit search been reported in scala/bug before?
I don't know. There are many issues about existential types. It's probably not so much the implicit search being involved, but rather type inference messing up with skolems and type variables.
Actually in this example implicit search does matter, because internally it uses an existential abstraction to find implicit candidates.
I didn't get an answer on the scala list, and don't see this particular case already on the bug tracker. Then again, i don't really understand why this isn't working, so i may have missed it.
Repro example showing the failure:
Scalac: https://scastie.scala-lang.org/2hFKFaBtSoiJuBDgt26vwA Dotty: https://scastie.scala-lang.org/TgdSZ64xS8e7Ta8HjzZyig
Scala-users thread: https://users.scala-lang.org/t/implicit-resolution-quirk/528/4