We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
_
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Current head, i.e., 9585868 with -language:experimental.fewerBraces
-language:experimental.fewerBraces
object Test { def main(args: Array[String]): Unit = val xs = List((1, "hello"), (2, "bar")) val ys = xs.map (_, str) => val len = str.length len * len println(ys) }
-- [E081] Type Error: tests/run/hello.scala:4:21 ------------------------------- 4 | val ys = xs.map (_, str) => | ^ | Missing parameter type | | I could not infer the type of the parameter _$1 of expanded function: | _$1 => | xs.map( | (_$1, str) => | { | val len = str.length | len * len | } | ). 1 error found
I expect it to compile.
Giving an (unused) name to the parameter makes it compile and run successfully:
object Test { def main(args: Array[String]): Unit = val xs = List((1, "hello"), (2, "bar")) val ys = xs.map (unused, str) => val len = str.length len * len println(ys) }
prints
List(25, 9)
The text was updated successfully, but these errors were encountered:
Fixed in #15273
Sorry, something went wrong.
odersky
Successfully merging a pull request may close this issue.
Compiler version
Current head, i.e., 9585868
with
-language:experimental.fewerBraces
Minimized code
Output
Expectation
I expect it to compile.
Workaround
Giving an (unused) name to the parameter makes it compile and run successfully:
prints
The text was updated successfully, but these errors were encountered: