Skip to content

Commit 8fca13d

Browse files
committed
Fix neg tests
Some neg tests now return more errors since we do stricter checking that comparisons with null make sense. There's an unfortunate interaction with `errorTerm` in Parser which returns a `null` literal as a tree when the parser gets confused. That null literal now causes follow on errors in some cases. I believe the right thing to do would be to let `errorTerm` return a tree with an `ErrorType`. I tried that, and it would remove again all the added errors in this commit. Unfortunately, it breaks SignatureHelpTest in a way I cannot fix.
1 parent 3c27142 commit 8fca13d

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

tests/neg/errpos.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ object Test {
1010
val b = type // error: expression expected (on "type")
1111

1212
1 match {
13-
case // error: pattern expected
13+
case // error: pattern expected // error: cannot compare with Null
1414
case 2 => ""
1515
}
1616
}

tests/neg/i1846.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ object Test {
33
val x = 42
44
val Y = "42"
55

6-
x match { case { 42 } => () } // error
7-
x match { case { 42.toString } => () } // error
8-
x match { case { 42 }.toString => () } // error
6+
x match { case { 42 } => () } // error // error
7+
x match { case { 42.toString } => () } // error // error
8+
x match { case { 42 }.toString => () } // error // error
99
x match { case "42".toInt => () } // error
10-
x match { case { "42".toInt } => () } // error
11-
x match { case { "42" }.toInt => () } // error
12-
x match { case { "42".toInt } => () } // error
10+
x match { case { "42".toInt } => () } // error // error
11+
x match { case { "42" }.toInt => () } // error // error
12+
x match { case { "42".toInt } => () } // error // error
1313
x match { case Y => () } // error
14-
x match { case { Y.toInt } => () } // error
15-
x match { case { Y }.toInt => () } // error
16-
x match { case { Y }.toString => () } // error
17-
x match { case { Y.toString } => () } // error
14+
x match { case { Y.toInt } => () } // error // error
15+
x match { case { Y }.toInt => () } // error // error
16+
x match { case { Y }.toString => () } // error // error
17+
x match { case { Y.toString } => () } // error // error
1818
}
1919
}

tests/neg/i3812.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ object Test {
33
val x = 42
44
val Y = "42"
55

6-
x match { case { 42 } => () } // error
7-
x match { case { "42".toInt } => () } // error
8-
x match { case { "42" }.toInt => () } // error
9-
x match { case { "42".toInt } => () } // error
10-
x match { case { Y.toInt } => () } // error
11-
x match { case { Y }.toInt => () } // error
6+
x match { case { 42 } => () } // error // error
7+
x match { case { "42".toInt } => () } // error // error
8+
x match { case { "42" }.toInt => () } // error // error
9+
x match { case { "42".toInt } => () } // error // error
10+
x match { case { Y.toInt } => () } // error // error
11+
x match { case { Y }.toInt => () } // error // error
1212
}
1313
}

0 commit comments

Comments
 (0)