Skip to content

Commit c553fd2

Browse files
added additonal check for boolean case
1 parent cca3d08 commit c553fd2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/neg-custom-args/fatal-warnings/i13011.scala

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ class i13011 {
66

77
lazy val simple3: String = if true then this.simple3 else "a" // error
88

9-
lazy val simple4: String = identity(this.simple4) // error
9+
def firstDigitIsEven(n: Int): Boolean = if n % 10 == n then n % 2 == 0 else firstDigitIsEven(n / 10)
10+
11+
lazy val simple4: String = if firstDigitIsEven(22) then this.simple4 else "a" // error
12+
13+
lazy val simple5: String = identity(this.simple5) // error
1014

11-
lazy val simple5: String = { // error
12-
this.simple5
15+
lazy val simple6: String = { // error
16+
this.simple6
1317
"aa"
1418
}
1519

16-
lazy val simple6: Function0[Any] = () => this.simple6 // Ok
20+
lazy val simple7: Function0[Any] = () => this.simple7 // Ok
1721
}

0 commit comments

Comments
 (0)