Skip to content

suite: triage and promote literals/goto/events/nextvar files#251

Merged
davydog187 merged 1 commit into
mainfrom
suite/triage-batch-1
May 28, 2026
Merged

suite: triage and promote literals/goto/events/nextvar files#251
davydog187 merged 1 commit into
mainfrom
suite/triage-batch-1

Conversation

@davydog187
Copy link
Copy Markdown
Contributor

Summary

Triage of the Lua 5.3 official suite, fixing concrete gaps and promoting four files out of the broad :all skip:

  • nextvar.lua — fully passing (was :all)
  • events.lua — runs with one targeted skip range (was :all)
  • goto.lua — runs with one targeted skip range (was :all)
  • literals.lua — runs with six targeted skip ranges (was :all)

Remaining :all files now carry specific reasons in test/lua53_skips.exs (e.g. checkerror format mismatches, missing utf8 library, coroutines unimplemented) instead of "pending initial triage".

Behavioural fixes

  • lexer: long strings drop a leading newline and normalise \r/\r\n/\n\r to \n per §3.1.
  • parser: reject non-lvalue assignment targets (e.g. 0 = 1) with a syntax error instead of crashing codegen.
  • scope: if/while/repeat/for bodies are now their own lexical scopes — locals declared inside no longer leak past the block (§3.3.4).
  • executor __eq: Lua 5.3 selection rules — first operand's metamethod, falling back to the second's; the same-function constraint from Lua 5.1 is dropped; only consulted for table-vs-table.
  • executor numeric: 0^(-n) yields the inf sentinel; NaN comparisons return false per IEEE 754.
  • table.insert: raise "wrong number of arguments" with more than 3 args.
  • ipairs: route lookups through __index so user metamethods drive iteration (§6.1).
  • type(): raise "value expected" with no args (was returning "nil").
  • debug.getinfo(N): return the calling frame's line and source via the executor's current_position + call_stack.
  • math: add math.modf (preserves integer parts) and math.ult.
  • string.find: handle negative init, init > #s + 1, and truthy (non-true) plain flag.
  • string.byte: PUC-Lua posrelat semantics for i and j.

Test plan

  • mix test — 1914 passing, 0 failures, 26 skipped (was 1907 passing before this PR)
  • mix compile --warnings-as-errors
  • mix format (no diff)
  • mix lua.suite --status shows 4 files promoted out of :all
  • New unit tests in test/lua/lexer_test.exs, test/lua/vm/metatable_test.exs, test/lua/vm/nextvar_semantics_test.exs pin each fix

Address a batch of conformance gaps that surfaced when running each
official Lua 5.3 suite file in isolation. nextvar.lua now passes
fully; literals.lua, goto.lua, and events.lua run with targeted skip
ranges instead of `:all`.

Behavioural fixes:
- lexer: long strings drop a leading newline and normalise CR/CRLF/LFCR
  to a single LF (§3.1).
- parser: reject non-lvalue assignment targets (e.g. `0 = 1`) with a
  syntax error instead of crashing codegen.
- scope: if/while/repeat/for bodies are their own lexical scopes; locals
  declared inside no longer leak past the block (§3.3.4).
- executor: __eq follows Lua 5.3 selection rules — first operand's
  metamethod, falling back to the second's, without the same-function
  requirement — and is only consulted for table-vs-table.
- executor: 0^(-n) yields the inf sentinel; NaN comparisons return
  false per IEEE 754.
- stdlib/table.insert: raise "wrong number of arguments" for >3 args.
- stdlib/ipairs: route lookups through __index so user-supplied
  metamethods drive iteration (§6.1).
- stdlib/type(): raise "value expected" with no args.
- stdlib/debug.getinfo(N): return the calling frame's line and source
  via the executor's current_position + call_stack.
- stdlib/math: add math.modf (integer-preserving) and math.ult.
- stdlib/string.find: handle negative init, init past length, and
  truthy (non-`true`) plain flag.
- stdlib/string.byte: PUC-Lua posrelat semantics for i and j.

Regressions pinned by new unit tests under test/lua/ covering each
fix. mix test: 1914 passing, 0 failures, 26 skipped.
@davydog187 davydog187 merged commit 303bccc into main May 28, 2026
5 checks passed
@davydog187 davydog187 deleted the suite/triage-batch-1 branch May 28, 2026 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant