-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better error recovery in comma-separated lists
Check for trailing commas in parser instead of scanner Instead of passing down a flag, add a bit to regions to say if we are in a comma-separated region. delimited instead of expectedToken
- Loading branch information
Showing
10 changed files
with
270 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
-- [E040] Syntax Error: tests/neg/comma-separated-errors.scala:3:21 ---------------------------------------------------- | ||
3 | def foo(x: Int = 5 6, y Int = 7, z: Int 5, x = 5): Unit = () // error // error // error // error | ||
| ^ | ||
| ')' expected, but integer literal found | ||
-- [E040] Syntax Error: tests/neg/comma-separated-errors.scala:3:26 ---------------------------------------------------- | ||
3 | def foo(x: Int = 5 6, y Int = 7, z: Int 5, x = 5): Unit = () // error // error // error // error | ||
| ^^^ | ||
| ':' expected, but identifier found | ||
-- [E040] Syntax Error: tests/neg/comma-separated-errors.scala:3:42 ---------------------------------------------------- | ||
3 | def foo(x: Int = 5 6, y Int = 7, z: Int 5, x = 5): Unit = () // error // error // error // error | ||
| ^ | ||
| ')' expected, but integer literal found | ||
-- [E040] Syntax Error: tests/neg/comma-separated-errors.scala:3:47 ---------------------------------------------------- | ||
3 | def foo(x: Int = 5 6, y Int = 7, z: Int 5, x = 5): Unit = () // error // error // error // error | ||
| ^ | ||
| ':' expected, but '=' found | ||
-- [E040] Syntax Error: tests/neg/comma-separated-errors.scala:11:16 --------------------------------------------------- | ||
11 | case Plus(4 1) => // error | ||
| ^ | ||
| ')' expected, but integer literal found | ||
-- [E040] Syntax Error: tests/neg/comma-separated-errors.scala:12:16 --------------------------------------------------- | ||
12 | case Plus(4 5 6 7, 1, 2 3) => // error // error | ||
| ^ | ||
| ')' expected, but integer literal found | ||
-- [E040] Syntax Error: tests/neg/comma-separated-errors.scala:12:28 --------------------------------------------------- | ||
12 | case Plus(4 5 6 7, 1, 2 3) => // error // error | ||
| ^ | ||
| ')' expected, but integer literal found | ||
-- [E040] Syntax Error: tests/neg/comma-separated-errors.scala:14:12 --------------------------------------------------- | ||
14 | val x: A[T=Int, T=Int] = ??? // error // error | ||
| ^ | ||
| ']' expected, but '=' found | ||
-- [E040] Syntax Error: tests/neg/comma-separated-errors.scala:14:19 --------------------------------------------------- | ||
14 | val x: A[T=Int, T=Int] = ??? // error // error | ||
| ^ | ||
| ']' expected, but '=' found |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class A[T] | ||
object o { | ||
def foo(x: Int = 5 6, y Int = 7, z: Int 5, x = 5): Unit = () // error // error // error // error | ||
|
||
case class Plus(a: Int, b: Int) | ||
|
||
object Plus { | ||
def unapply(r: Int): Plus = Plus(r - 1, 1) | ||
} | ||
5 match { | ||
case Plus(4 1) => // error | ||
case Plus(4 5 6 7, 1, 2 3) => // error // error | ||
} | ||
val x: A[T=Int, T=Int] = ??? // error // error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
class A[T] | ||
object o { | ||
// Testing compiler crash, this test should be modified when named type argument are completely implemented | ||
val x: A[T=Int, T=Int] = ??? // error: ']' expected, but '=' found // error | ||
val x: A[T=Int, T=Int] = ??? // error: ']' expected, but '=' found // error: ']' expected, but '=' found | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
-- Error: tests/neg/t11900.scala:44:16 --------------------------------------------------------------------------------- | ||
44 | a => a + 1, // error: weird comma | ||
| ^ | ||
| end of statement expected but ',' found | ||
-- Error: tests/neg/t11900.scala:48:16 --------------------------------------------------------------------------------- | ||
48 | println("a"), // error: weird comma | ||
| ^ | ||
| end of statement expected but ',' found | ||
-- Error: tests/neg/t11900.scala:52:16 --------------------------------------------------------------------------------- | ||
52 | println("b"), // error: weird comma | ||
| ^ | ||
| end of statement expected but ',' found | ||
-- [E032] Syntax Error: tests/neg/t11900.scala:64:8 -------------------------------------------------------------------- | ||
64 | _*, // error | ||
| ^ | ||
| pattern expected | ||
| | ||
| longer explanation available when compiling with `-explain` |
Oops, something went wrong.