From 693e9c6b4f9b0b8bee07fbf3739557108d199844 Mon Sep 17 00:00:00 2001 From: Thibault Czarniak Date: Tue, 20 Aug 2024 11:53:08 +0200 Subject: [PATCH] Added compound operator test cases to VarCouldBeVal --- input/src/main/scala/fix/VarCouldBeVal.scala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/input/src/main/scala/fix/VarCouldBeVal.scala b/input/src/main/scala/fix/VarCouldBeVal.scala index 8891082..88996ba 100644 --- a/input/src/main/scala/fix/VarCouldBeVal.scala +++ b/input/src/main/scala/fix/VarCouldBeVal.scala @@ -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 + } + } + }