We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
import quoted.Toolbox.Default._ val v = '{ (if true then Some(1) else None).map(v => v+1) } v.show
will output (in REPL, Dotty 0.12.0):
val res0: String = if (true) scala.Some.apply[scala.Int](1) else scala.None.map[scala.Int](((v: scala.Int) => v.+(1))) ...
The confusing part is scala.None.map[scala.Int](..., which unless closely inspected suggests that we are calling None.map instead of (if ...).map.
scala.None.map[scala.Int](...
None.map
(if ...).map
Perhaps adding brackets around if expressions that are in this situation (the LHS of a method call) might help?
The text was updated successfully, but these errors were encountered:
quoted.Expr.{run,show}
It is clearly missing a pair of ( and ) around the if then else
(
)
if then else
It should print
val res0: String = (if (true) scala.Some.apply[scala.Int](1) else scala.None).map[scala.Int](((v: scala.Int) => v.+(1)))
Sorry, something went wrong.
c5fb061
Merge pull request #6182 from dotty-staging/fix-#5997
1818972
Fix #5997: Add missing parentheses
No branches or pull requests
will output (in REPL, Dotty 0.12.0):
The confusing part is
scala.None.map[scala.Int](...
, which unless closely inspected suggests that we are callingNone.map
instead of(if ...).map
.Perhaps adding brackets around if expressions that are in this situation (the LHS of a method call) might help?
The text was updated successfully, but these errors were encountered: