Enforce visibility in WASM exports, improve error messages, make examples runnable#107
Merged
Conversation
…essages Only public functions are now exported as WASM entry points. Private functions still compile (callable internally) but are not accessible via `vera run`. The codegen gates both the exports list and the WAT-level `(export ...)` annotation on visibility, including for monomorphized generic functions. When `vera run` finds no exported functions, it now prints a detailed diagnostic listing all declared functions with their visibility, any compilation warnings, and a suggestion to make a function public. A similar message appears when `--fn` targets a private function. All examples now have public test entry points so `vera run` works on them. Documentation (README, SKILLS, spec, docs site) updated to show public visibility on entry-point examples. Co-Authored-By: Claude <noreply@anthropic.invalid>
Co-Authored-By: Claude <noreply@anthropic.invalid>
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
publicfunctions are exported as WASM entry points. Private functions still compile but aren't accessible viavera run. Applies to both regular and monomorphized generic functions.vera runon a file with no public functions now shows all declared functions with visibility, compilation warnings, and a suggestion. Targeting a private function with--fngives a specific error.publictest entry points (e.g.vera run examples/factorial.vera --fn test_factorial).publicvisibility on entry-point examples.Test plan
pytest tests/ -q)mypy vera/)vera checkandvera verifyCloses the behavioral gap where
privatefunctions were incorrectly exported as WASM entry points.Related: #106 (Int-to-String stdlib needed for proper
mainentry points)Generated with Claude Code