mirror of
https://github.com/fluffos/fluffos
synced 2026-08-12 18:26:06 -04:00
Four new compiler test files pin the language surface end-to-end (121 checks): syntax_literals (integer bases, digit separators, float forms including the trailing-dot spelling, char/string escapes, adjacent concatenation, in-string line continuation, constant folding), syntax_operators (C-precedence pins across the merged token families, every compound assignment including <<= >>= &&= ||= ??=, ?? vs 0, short-circuiting, ++/-- lvalue forms, comma expressions, all range spellings, casts), syntax_control (do/while, for with comma clauses and empty header, dangling else, string switches, open-ended case ranges, fallthrough, catch and time_expression in expression AND block forms), and syntax_functions (:: and named-scope super calls, varargs + call spread, expression defaults, function-typed lambdas, new(class X, field: value) initializers). Writing them caught a real regression: the named-scope super-call matcher (compiler.cc) hardcoded a 2-byte ".c" suffix when comparing `name::fn()` against inherited program names, so every named super call into an .lpc-compiled parent failed to resolve -- and the entire testsuite had no named-scope call to notice. The matcher now strips the real extension. fail/lambda_typed_return.lpc pins that lambdas accept only the 'function' return type. The review also surfaced three language facts the JS tooling had wrong or the tests mis-assumed, now pinned: LPC floats have NO exponent notation (tokenizer.mjs and the generated tmLanguage accepted "2.5e2" as one number; the hand-authored EBNF was already right), there is no open-low index range "[..n]" (only case labels support it), and casts are type assertions, not conversions. Verified: testsuite x3 + ctest 297 (ASan Debug), clang RelWithDebInfo sanitizer full suite, RelWithDebInfo full ctest, lpc-syntax node tests (48). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
3 lines
134 B
Text
3 lines
134 B
Text
// Fixture for /single/tests/compiler/syntax_functions.lpc (super-call
|
|
// and named-scope pins).
|
|
string pwhich() { return "parent"; }
|