oleg-py/better-monadic-for

Anonymous variable flagged as error

sdavidp opened this issue · 7 comments

Using Scala 2.12.7,

[error] [snip]/Server.scala:29:7: parameter value x$2 in value $anonfun is never used
[error]       _ <- Stream.eval(foo)
[error]       ^

where foo is a function returning F[Unit]
I haven't been able to reproduce the issue with a simple code example but Chris Davenport (who identified better-monadic-for as the culprit) thinks it is a problem with the macro expansion.
E.g., in our piece of code if I have two such lines above the error is flagged on the 2nd one, even if I swap their order in the for-comprehension.

This was seen using releases 0.2.4 and 0.3.0-M2.

@sdavidp thanks for the report, I'll take a look this weekend.

In the meantime, can you try adding -P:bm4:no-tupling:n to scalacOptions and see if it fixes the problem?

@oleg-py Yes it does. Thank you Oleg!

I published the 0.3.0-M3 version just now. Give it some time to sync to Maven, and try it out without disabling untupler - should work properly now.

I derped and used wrong bitwise operator. My apologies! M4 is on its way - it seems to work in the code samples I managed to discover.

If it doesn't work, I'll switch to working it in snapshots. If so, please provide the structure of your for-comprehensions - just obscure the variable names and replace the RHS of each bindings by ???, I'll figure it from here

Ok, thanks for keeping me informed :)