holgerbrandl / r4intellij

An integration of the R programming language into Intellij IDEA
BSD 2-Clause "Simplified" License
148 stars 28 forks source link

Wrong warning: Variable 'fields' is never used #210

Open rillig opened 4 years ago

rillig commented 4 years ago
wrong.warning <- function(key, values)
{
  fields <- list()
  for (l in values)
  {
    value <- unlist(l)
    if (value != '')
    fields <- append(fields, 'yes')
    else
    fields <- append(fields, 'no')
  }
  fields
}

image

The variable assignment in the then branch is marked as unused, but the one from the else branch isn't. That's inconsistent.

holgerbrandl commented 4 years ago

Known issue, but I never found a good way to fix this.