Skip to content

Commit 8875165

Browse files
Change error message for missing closing } in interface declaration (#1054)
In #1008 the error message for ``` interface Foo { def greet(): Unit ``` changed from ``` expected }, got end of file ``` to ``` expected operation declaration, got end of file ``` This goes back to also mentioning the `}`.
1 parent 9c5ce93 commit 8875165

File tree

5 files changed

+7
-3
lines changed

5 files changed

+7
-3
lines changed

effekt/shared/src/main/scala/effekt/RecursiveDescent.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ class RecursiveDescent(positions: Positions, tokens: Seq[Token], source: Source)
536536
// InterfaceDef(`interface` ~> idDef(), maybeTypeParams(),
537537
// `{` ~> manyWhile(documented { opDoc => `def` ~> operation(opDoc) }, documentedKind == `def`) <~ `}`, doc, span())
538538
InterfaceDef(`interface` ~> idDef(), maybeTypeParams(),
539-
`{` ~> manyUntil(documented { opDoc => { `def` ~> operation(opDoc) } labelled "operation declaration" }, `}`) <~ `}`, doc, span())
539+
`{` ~> manyUntil(documented { opDoc => { `def` ~> operation(opDoc) } labelled "} or another operation declaration" }, `}`) <~ `}`, doc, span())
540540
}
541541

542542
def namespaceDef(): Def =
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[error] examples/neg/parsing/eof-instead-of-token.effekt:1:16: Expected operation declaration but got end of file
1+
[error] examples/neg/parsing/eof-instead-of-token.effekt:1:16: Expected } or another operation declaration but got end of file
22
interface Foo {
33
^
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[error] examples/neg/parsing/interface-missing-brace.effekt:1:36: Expected } or another operation declaration but got end of file
2+
interface Greet { def hello(): Unit
3+
^
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
interface Greet { def hello(): Unit
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[error] examples/neg/parsing/val-in-interface.effekt:2:3: Expected operation declaration but got keyword val
1+
[error] examples/neg/parsing/val-in-interface.effekt:2:3: Expected } or another operation declaration but got keyword val
22
val x = 4
33
^^^

0 commit comments

Comments
 (0)