Closed
Description
Compiler version
3.2.1-RC1
Minimized code
class Delta:
val value = 1
def f(v: Int)(using delta: Delta): Int =
v + delta.value
def run(): Unit =
val delta = Delta()
val x: Map[Char, Int] = Map(
'a' -> 0,
'b' -> 1
)
val y: Map[Char, Int] = x.map((k, v) => (k, f(v)(using delta)))
Output
it doesn't compile when -Ycc
is enabled.
[error] 15 | val y: Map[Char, Int] = x.map((k, v) => (k, f(v)(using delta)))
[error] | ^^^^^
[error] |None of the overloaded alternatives of method map in trait IterableOps with types
[error] | [B](f: ((Char, Int)) => B): scala.collection.immutable.Iterable[B]
[error] | [K2, V2](f: ((Char, Int)) => (K2, V2)): Map[K2, V2]
[error] |match arguments ((<?>, <?>) -> <?>)
[error] one error found
With -Ycc
flag, it works fine if we specify the type of parameters:
val y: Map[Char, Int] = x.map((k: Char, v: Int) => (k, f(v)(using delta)))
It works fine when -Ycc
is disabled.
Expectation
It's expected to be compiled when -Ycc
is enabled.