Skip to content

Commit

Permalink
Added compound operator test cases to VarCouldBeVal
Browse files Browse the repository at this point in the history
  • Loading branch information
t1b00 committed Aug 20, 2024
1 parent 94a81af commit 693e9c6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions input/src/main/scala/fix/VarCouldBeVal.scala
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,19 @@ object VarCouldBeVal {
l.foreach(e => modif = e)
}

def foo15 = {
var a = 0 // assert: VarCouldBeVal
if (a != 0) println("test")
if (a >= 0) println("test")
if (a <= 0) println("test")
}

def foo16 = {
var a = 0 // scalafix: ok;
if (a != 0) println("test")
else {
a *= 2
}
}

}

0 comments on commit 693e9c6

Please sign in to comment.