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 =
23
23
class X extends AnyRef , Serializable // error
24
24
27 // error
25
25
)
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 =
41
41
@ nowarn(" msg=Unit" )
42
42
def onlyIf (x : Int ): Unit =
43
43
callme(
44
- if (x > 0 )
44
+ if (x > 0 ) then // then syntax required
45
45
true , " fail" ) // warn value discard
46
46
47
47
def h (xs : List [Int ]) =
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ def orElse(x: Int): Unit =
36
36
37
37
def onlyIf (x : Int ): Unit =
38
38
callme(
39
- if ( x > 0 )
39
+ if x > 0 then
40
40
true , " fail" ) // warn value discard
41
41
42
42
def h (xs : List [Int ]) =
You can’t perform that action at this time.
0 commit comments