Skip to content

Enforce visibility in WASM exports, improve error messages, make examples runnable#107

Merged
aallan merged 2 commits into
mainfrom
fix/visibility-exports-examples
Feb 27, 2026
Merged

Enforce visibility in WASM exports, improve error messages, make examples runnable#107
aallan merged 2 commits into
mainfrom
fix/visibility-exports-examples

Conversation

@aallan

@aallan aallan commented Feb 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Codegen visibility gate: Only public functions are exported as WASM entry points. Private functions still compile but aren't accessible via vera run. Applies to both regular and monomorphized generic functions.
  • Better error messages: vera run on a file with no public functions now shows all declared functions with visibility, compilation warnings, and a suggestion. Targeting a private function with --fn gives a specific error.
  • Runnable examples: All 13 non-module examples now have public test entry points (e.g. vera run examples/factorial.vera --fn test_factorial).
  • Documentation updates: README, SKILLS, spec chapters 5-7, and docs site updated to show public visibility on entry-point examples.

Test plan

  • 935 tests pass (pytest tests/ -q)
  • mypy clean (mypy vera/)
  • All 14 examples pass vera check and vera verify
  • README and spec code block validation scripts pass
  • 3 new tests for no-exports and private-fn-targeted error messages
  • Pre-commit hooks pass (mypy, pytest, examples, readme)

Closes the behavioral gap where private functions were incorrectly exported as WASM entry points.

Related: #106 (Int-to-String stdlib needed for proper main entry points)

Generated with Claude Code

…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>
@aallan aallan merged commit 4be3839 into main Feb 27, 2026
10 checks passed
@aallan aallan deleted the fix/visibility-exports-examples branch February 27, 2026 15:20
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