Repository navigation
One-liner code is statements; let-only entry file explains missing main (#1816) - #1938
Merged
Merged
Conversation
…nly entry file says why it has no main (#1816) A CLI one-liner (and a REPL line) is top-level executable statements by construction (§18.5b), so its top-level `let`/`var`s are main's locals even when nothing else is there. Before, `with -e 'let x = 1'` read the `let` as a module global, produced no main, and died in the linker with "undefined symbol: _main". An entry file of only `let`s stays a module of globals (D74); building it as a program now fails with "has no `fn main` and no top-level statement to run" instead of the raw link error. Test: behav_1816_let_only_entry.w fails on the installed compiler (the lld _main error) and passes on stage1. Gate green.
… block or a refusal
`static inline void f(void) {}` was refused ("inline body translation
failed"): ci_trans_stmt_via_ir answered "" both when a statement failed to
lower and when it lowered to nothing, so an empty body read as a failure.
Once ff95562 read a cast to Unit as void, `{ (void)d; }` lowered to a
blank body and printed `-> Unit:` with nothing under it — a parse error
that turned behav_c_import_opaque_member_receiver red in the #1940 battery.
ci_trans_stmt_ir now says whether the statement lowered, apart from its
text. A lowered void body with no text is `return`; a non-void body with
nothing to return still has no translation, and a failed lowering still
fails.
Test: behav_c_import_empty_void_body.w fails on the pre-fix compiler (the
parse error) and passes on stage1; behav_c_import_opaque_member_receiver
passes again.
Contributor
Author
|
Battery GREEN on stack top d55a6aa (seed-driven, |
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.
Fixes #1816.
with -e 'let x = 1'runs (one-liner/REPL entry is statements by construction, §18.5b); a let-only entry file fails with a clear diagnostic instead ofundefined symbol: _main. Regression test red on the installed compiler, green on stage1; gate green. Joins the next batch stack.