File tree Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ def orElse(x: Int): Unit =
4141@ nowarn(" msg=Unit" )
4242def 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
4747def h (xs : List [Int ]) =
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ def orElse(x: Int): Unit =
3636
3737def onlyIf (x : Int ): Unit =
3838 callme(
39- if ( x > 0 )
39+ if x > 0 then
4040 true , " fail" ) // warn value discard
4141
4242def h (xs : List [Int ]) =
You can’t perform that action at this time.
0 commit comments