fix(selfhost/parser): skip newlines inside expressions

The selfhost parser did not skip tkNewLine tokens inside expression parsing,
causing multi-line expressions (e.g. if conditions spanning lines with ||)
to be truncated. When parserParseBinaryPrec hit a newline it treated it as
an invalid primary, returning a malformed literal and leaving p.pos at the
newline. parserParseBlock then failed to find '{' and its depth-counter
fallback consumed far too many tokens, causing subsequent function bodies
to be parsed into the wrong AST nodes.

Fix: add newline skipping in parserParsePrimary, parserParseUnary, and
parserParseBinaryPrec, matching the bootstrap parser's skipNewlines() calls
in parseAnd/parseOr.

Also complete the variant cap raise from 8->9 in src/sema.bux (was already
done in ast.bux, parser.bux, hir_lower.bux).
This commit is contained in:
2026-06-08 19:45:05 +03:00
parent b1deff7fd5
commit 2cb971a483
5 changed files with 74 additions and 31 deletions
+1
View File
@@ -1006,6 +1006,7 @@ func HirLower_LowerModule(mod: *Module, sema: *Sema) -> *HirModule {
if vi == 5 { v = &decl.variant5; }
if vi == 6 { v = &decl.variant6; }
if vi == 7 { v = &decl.variant7; }
if vi == 8 { v = &decl.variant8; }
if v != null as *EnumVariant {
hm.enums[ei].variants[vi].name = v.name;
hm.enums[ei].variants[vi].fieldCount = v.fieldCount;