ww package: reject non-function main declarations
This commit is contained in:
@@ -268,6 +268,21 @@ check rather than part of `ww build`. Assembly-only `-S` still selects command
|
||||
actions and rejects a no-command directory request, but it performs no
|
||||
install-only destination validation or output-directory creation.
|
||||
|
||||
Package declaration checking also precedes test execution. In a package whose
|
||||
declared name is `main`, `let main`, `const main`, `def main`, and `type main`
|
||||
are rejected by both compiler stages as `cannot declare main - must be func`
|
||||
and are not installed into package scope. The generated directory-test main is
|
||||
an independent tool-owned action and cannot mask the malformed production or
|
||||
same-package declaration: the product emits no test body output, accounting,
|
||||
or `ok` result. This condition keys only on the source-declared package name;
|
||||
a package with another declared name may export `main` even when its dotted
|
||||
path or physical leaf is `main`, and WW's supported argument/result-bearing
|
||||
function entries remain valid. The native
|
||||
`nonfunction_main_declarations_reject` observer covers all four declaration
|
||||
kinds, direct compiler ownership, build/test diagnostics, command-import
|
||||
precedence, declared-name/import identity, valid artifact bytes, cold cleanup,
|
||||
and warm work/output rollback and reuse across both stages.
|
||||
|
||||
The retained executable is byte-identical to the temporary runnable and has
|
||||
executable mode `0777` filtered by the caller's umask, but it is never the path
|
||||
executed by the coordinator. Compile-only publication participates in the
|
||||
|
||||
Reference in New Issue
Block a user