scalafix
scalafix copied to clipboard
error fix :remove unsed
before :
private var upstreamFailed: OptionVal[Throwable] = OptionVal.None
after
OptionVal.None
source :akka.stream.impl.fusing.ActorGraphInterpreter.ActorOutputBoundary

@hepin1989, looks like this behavior is intentional (see tests: input / output). The reason is that the the ~LHS~ RHS of a val/var definition may contain side effects. Thus, removing the entire line could change the behavior of the program. However, if the ~LHS~ RHS is a literal, then the rule does remove the entire thing.
@marcelocenerine after you removed that ,Akka did not compile:)
@hepin1989 what is the resulting compile error?
We can probably remove the right-hand side if it only references vals. We can try to reproduce what the compiler does
sorry, I meant RHS in my previous comment.
The following causes a compiler error:
- Input:
private val opt: Option[String] = None
private val num: Integer = { println("foo"); 1 }
- Output:
None
{ println("foo"); 1 }
None.type does not take parameters
[error] { println("foo"); 1 }
[error] ^
Aah yes :) that is a good test case! Thank you @marcelocenerine
@olafurpg could not find the symbol.
@olafurpg I only make use of scalafix for remove the unused import now.the problem presents when I use the default settings.