File tree 2 files changed +30
-12
lines changed
2 files changed +30
-12
lines changed Original file line number Diff line number Diff line change 1
1
object Test {
2
2
def main (args : Array [String ]): Unit = {
3
3
val x = 42
4
- val Y = " h "
4
+ val Y = " 42 "
5
5
6
- x match { case { 42 } => 42 } // ok
7
- x match { case { 42 .toString } => 42 } // error
8
- x match { case { 42 }.toString => 42 } // error
9
- x match { case { " h" }.toString => println(42 ) } // error
10
- x match { case { " h" .toString } => println(42 ) } // error
11
- x match { case Y => println(42 ) } // error
12
- x match { case Y .toString => println(42 ) } // error
13
-
14
- Y match { case Y .toString => println(42 ) } // ok
15
- Y match { case { Y .toString } => println(42 ) } // ok
16
- Y match { case { Y }.toString => println(42 ) } // ok
6
+ x match { case { 42 } => () } // ok
7
+ x match { case { 42 .toString } => () } // error
8
+ x match { case { 42 }.toString => () } // error
9
+ x match { case " 42" .toInt => () } // error
10
+ x match { case { " 42" .toInt } => () } // ok
11
+ x match { case { " 42" }.toInt => () } // ok
12
+ x match { case { " 42" .toInt } => () } // ok
13
+ x match { case Y => () } // error
14
+ x match { case Y .toInt => () } // ok
15
+ x match { case { Y .toInt } => () } // ok
16
+ x match { case { Y }.toInt => () } // ok
17
+ x match { case Y .toString => () } // error
18
+ x match { case { Y }.toString => () } // error
19
+ x match { case { Y .toString } => () } // error
17
20
}
18
21
}
Original file line number Diff line number Diff line change
1
+ object Test {
2
+ def main (args : Array [String ]): Unit = {
3
+ val x = 42
4
+ val Y = " 42"
5
+
6
+ x match { case { 42 } => () } // ok
7
+ x match { case { " 42" .toInt } => () } // ok
8
+ x match { case { " 42" }.toInt => () } // ok
9
+ x match { case { " 42" .toInt } => () } // ok
10
+ x match { case { Y .toInt } => () } // ok
11
+ x match { case { Y }.toInt => () } // ok
12
+
13
+ // x match { case Y.toInt => () } // compiles but rejected by Ycheck
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments