Repository navigation
Fix frontend contracts and native regression tests - #723
Merged
Merged
Conversation
Keep hex escapes as bytes, reject embedded string NULs, and preserve UTF-8 source text. Handle LF, CRLF, and CR consistently. Validate text-only literal contexts and propagate extern type errors as structured diagnostics. Refs wavefnd#388, wavefnd#389, wavefnd#390, wavefnd#391, wavefnd#392, wavefnd#425, wavefnd#598, wavefnd#599. Signed-off-by: LunaStev <[email protected]>
Track nested comments after target attributes while preserving original line endings and offsets. Reject invalid std module paths and canonical targets outside the std root. Refs wavefnd#598, wavefnd#644, wavefnd#645. Signed-off-by: LunaStev <[email protected]>
Canonicalize array, pointer, and record aliases for reads, writes, dereferences, and member accesses without changing invalid-access diagnostics. Refs wavefnd#709. Signed-off-by: LunaStev <[email protected]>
Require zero entry-point parameters even when every parameter has a default value. Preserve default arguments on ordinary helper functions. Refs wavefnd#452. Signed-off-by: LunaStev <[email protected]>
Report local const/static declarations and malformed match patterns, arrows, and bodies through source-located parser errors instead of direct output. Refs wavefnd#394, wavefnd#396. Signed-off-by: LunaStev <[email protected]>
Exercise nested generic types, imported aliases, exact literal bytes, NUL rejection, and human/JSON diagnostics. Run O0/O2 cases and check entry signatures across hosted, freestanding, and WASI targets. Refs wavefnd#393, wavefnd#394, wavefnd#396, wavefnd#425, wavefnd#452, wavefnd#598, wavefnd#599, wavefnd#709. Signed-off-by: LunaStev <[email protected]>
Signed-off-by: LunaStev <[email protected]>
Preserve pointer, length, capacity, contents, and the exit-42 success contract when buffer_append rejects the range. Clarify external source validity and run the complete native case at O0/O2. Fixes wavefnd#708. Signed-off-by: LunaStev <[email protected]>
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix frontend contracts that could change literal bytes, reject valid alias accesses, misreport source locations, or accept unsupported entry signatures. Correct native regression tests for Windows text output and Linux buffer source ranges.
Preserve exact
\xNNbytes alongside UTF-8 source characters throughout lexing, parsing, and LLVM lowering. Reject embedded string NULs and validate literals used as text-only names or assembly.Treat LF, CRLF, and standalone CR as one logical newline, including comments, target preprocessing, and diagnostics.
Resolve aliases before validating array/pointer/record accesses, and reject every parameterized
main, including defaulted parameters.Contain canonical std imports within the std root and handle nested multiline comments after target attributes.
Return structured local-storage, match, and extern-type diagnostics. Add lexer, nested-type, human/JSON diagnostic, and O0/O2 execution regressions.
Match Windows CRLF output without normalizing the non-UTF-8 payload being tested. Replace the Linux amd64 buffer case's ambiguous one-past source with an invalid internal range and assert rejection preserves metadata and contents.
Motivation
Closes #599, closes #598, closes #452, closes #709, closes #644, closes #645.
Closes #394, closes #396, closes #425, closes #708.
Closes #388, closes #389, closes #390, closes #391, closes #392, closes #393.
The existing implementations and regression tests for #395, #397, #398, and #399 were also checked. Those four diagnostic migrations were already present on master; this PR does not claim to introduce them.
Target and compatibility impact
The maintainer-approved language rules are: hex escapes denote exact bytes, ordinary source characters retain UTF-8 encoding, embedded string NULs are errors, all three source newline forms are equivalent, and
mainaccepts zero parameters. Ordinary helper-function default arguments remain supported.Literal bytes are represented in the shared lexer/AST and consumed by LLVM lowering. No new runtime ABI, libc FFI, or toolchain selection policy is introduced. Compatibility-revision validation remains intact. Target-independent entry checks are covered for hosted, freestanding, and WASI compilation.
Validation
Rust checks used LLVM 21 at
/usr/lib64/llvm21and--jobs 2:python3 tools/check_wave_corpus.py --wavec target/release/wavec --run-std-examples: 288 source checks passed. All 26 std examples passed after rerunning the seven socket-dependent binaries outside the network-restricted sandbox. The existing async TCP test likewise passed with local sockets permitted.test137andtest138passed at O0/O2 under AArch64, RISC-V, and LoongArch QEMU, plus WASM32, WASM64, and WASI runners: 24 executions. Native O0/O2 tests also verify imported aliases, emitted bytes, and exact non-UTF-8 output.Additional validation for the native regression fixes:
cargo test --locked --test codegen_regressions phase1_literal_printing_preserves_non_utf8_bytes --jobs 2: passed locally at O0/O2. The Windows expectation now matches the CRLF bytes in the failed native CI log; Windows execution remains for CI to verify.cargo test --locked --test boundary_regressions linux_buffer_case_preserves_invalid_range_state_and_success_exit --jobs 2: the complete Linux amd64test23.wavepassed with exit 42 at O0/O2, using the matching staged std. The case checks unchanged pointer, length, capacity, and contents after rejecting the invalid range.cargo test --locked --test boundary_regressions buffer_append_handles_adjacent_allocations_and_moving_self_sources --jobs 2: passed at O0/O2, retaining Do not classify an adjacent allocation as an internal buffer_append source #676 coverage for valid adjacent allocations and moving self-appends.-D warnings, formatting, std policy, and whitespace checks passed. The half-open allocation check and case success-exit contract remain unchanged.Checklist
Signed-off-byline.std/.