Unexpected parsing behavior with semicolons
We have observed in #1074 that the parsed tree changes (modulo spans) depending on semicolons, which should not happen in these cases.
The cases giving different trees on parseProgram:
namespace list;
namespace internal;
val x = 4
val y = 5
vs.
namespace list
namespace internal
val x = 4
val y = 5
vs.
namespace list
namespace internal
val x = 4
val y = 5;
which can be reproduced by (progA.defs zip progB.defs).foreach(assertEqualModuloSpans)
@phischu is right to question why there should be a semicolon on the toplevel at all. Does anybody see a single valid use case?
Consistency: When I have definitions in a block (so not top-level), I can, and sometimes must add a semicolon, see https://github.com/effekt-lang/effekt/issues/1064#issuecomment-3023359028. So then I find myself writing things like val x = 4; with a semicolon reflexively even on the top-level.
#595 is, in my eyes, somewhat related to this.