[error] -- [E081] Type Error: /Users/daniel/Development/Scala/cats-effect/series-3.x/kernel/shared/src/main/scala/cats/effect/kernel/Resource.scala:871:43
[error] 871 | _(fa.use_ !> fb.allocated).map(_.map(fin => (_: Resource.ExitCase) => fin)))
[error] | ^^^
[error] | Missing parameter type
[error] |
[error] | I could not infer the type of the parameter fin.
If I ascribe the correct type for fin, it still doesn't work:
Both the inner and outer map calls are implicitly enriched syntax. There's really a lot going on in this and it does need to be minimized, but I wanted to get it up here so we don't lose track of it, especially since this particular file is triggering a lot of compiler bugs for some reason…
Update: Apparently map is available on tuple in Scala 3, but (obviously) not in Scala 2, which thus interferes with the syntax made available by Cats. That's the root of this issue. Leaving the above for posterity. This is definitely going to break quite a bit of code.
Another unminimized one. Sorry…(figured it out: see addendum at the end)https://github.com/djspiewak/cats-effect/tree/bug/dotty-inference-issue To reproduce,
sbt ++3.0.0-M3 kernelJVM/clean kernelJVM/compile
. Note that this branch compiles just fine if you do++2.13.3
or++2.12.10
instead. One of the offending lines:https://github.com/djspiewak/cats-effect/blob/bug/dotty-inference-issue/kernel/shared/src/main/scala/cats/effect/kernel/Resource.scala#L871
And the error:
If I ascribe the correct type for
fin
, it still doesn't work:Both the inner and outer
map
calls are implicitly enriched syntax. There's really a lot going on in this and it does need to be minimized, but I wanted to get it up here so we don't lose track of it, especially since this particular file is triggering a lot of compiler bugs for some reason…Update: Apparently
map
is available on tuple in Scala 3, but (obviously) not in Scala 2, which thus interferes with the syntax made available by Cats. That's the root of this issue. Leaving the above for posterity. This is definitely going to break quite a bit of code.