Skip to content

Commit

Permalink
Scalafmt
Browse files Browse the repository at this point in the history
  • Loading branch information
t1b00 committed Aug 26, 2024
1 parent 2c19424 commit 814c77e
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions input/src/main/scala/fix/VariableShadowing.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ object VariableShadowing {

class Test4 {
val a = 1
def foo(b : Int) = b match {
def foo(b: Int) = b match {
case f =>
def boo() = {
val a = 2 // assert: VariableShadowing
Expand All @@ -40,14 +40,14 @@ object VariableShadowing {
}

class Test5 {
def foo(a : Int) = {
def foo(a: Int) = {
val a = 1 // assert: VariableShadowing
println(a)
}
}

class Test6 {
def foo(a : Int) = {
def foo(a: Int) = {
println(a)
def boo = {
val a = 2 // assert: VariableShadowing
Expand All @@ -71,20 +71,20 @@ object VariableShadowing {
val something = 4
if (1 > 0) {
val something = 4 // assert: VariableShadowing
println(something+1)
println(something + 1)
} else {
val something = 2 // assert: VariableShadowing
println(something+2)
println(something + 2)
}
}

class Test9 {
if (1 > 0) {
val something = 4 // scalafix: ok;
println(something+1)
println(something + 1)
} else {
val something = 2 // scalafix: ok;
println(something+2)
println(something + 2)
}
}

Expand Down Expand Up @@ -117,10 +117,9 @@ object VariableShadowing {
for (i <- 1 to 10) println(i.toString) // scalafix: ok;
for (i <- 1 to 10) println(i.toString) // scalafix: ok;


for {
c <- "Hello, world!" // scalafix: ok;
if c != ','
c <- "Hello, world!" // scalafix: ok;
if c != ','
} println(c)

object Test1 {
Expand All @@ -144,7 +143,7 @@ object VariableShadowing {

def test(shadowedArg: AnyVal): Boolean =
shadowedArg match {
case l1: Long => testCaller(l1, testCallbackFunction1) // scalafix: ok;
case l1: Long => testCaller(l1, testCallbackFunction1) // scalafix: ok;
case l2: Double => testCaller(l2.toLong, testCallbackFunction2)
case l3 => false
}
Expand Down

0 comments on commit 814c77e

Please sign in to comment.