scala / scala-abide

obsolete; visit https://github.com/scalacenter/scalafix instead

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

False positive for unused value in for comprehension

leifwickland opened this issue · comments

I'm not exactly sure of the minimal case for this one, but a value in a for comprehension which is filtered and/or passed passed to a function but not directly yielded is incorrectly reported as unused

final object StringUtils {
  val b = for {
    i <- 1 to 5
    if i % 2 == 0
    a = f(i) * 2
  } yield a
}

The error message is:

warning: value i is not used.
    i <- 1 to 5
    ^

(Apologies if this doesn't produce a reproducible test case. I'm attempting to replicate an example from a closed code base. If you struggle to produce the reported error, I'd be happy to attempt to offer a better example.)

I think it has the same root as #47... We should find a way to "merge" uses of different symbols that correspond to the same source entity.

Abide is superseded by https://github.com/scalacenter/scalafix; closing all issues