Skip to content

Commit 0f7460d

Browse files
committed
Fix test syntax
1 parent 90f6cea commit 0f7460d

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

tests/neg/i22527.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ def g: Unit =
2323
class X extends AnyRef, Serializable // error
2424
27 // error
2525
)
26+
27+
def onlyIf(x: Int): Unit =
28+
callme(
29+
if (x > 0)
30+
true, "fail") // error syntax is broken after old-style conditional

tests/pos/i22527.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def orElse(x: Int): Unit =
4141
@nowarn("msg=Unit")
4242
def onlyIf(x: Int): Unit =
4343
callme(
44-
if (x > 0)
44+
if (x > 0) then // then syntax required
4545
true, "fail") // warn value discard
4646

4747
def h(xs: List[Int]) =

tests/warn/i22527.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def orElse(x: Int): Unit =
3636

3737
def onlyIf(x: Int): Unit =
3838
callme(
39-
if (x > 0)
39+
if x > 0 then
4040
true, "fail") // warn value discard
4141

4242
def h(xs: List[Int]) =

0 commit comments

Comments
 (0)