Skip to content

Report a backend error naming the builtin instead of raising NotImplementedError on wasm - #251

Merged
zimri-leisher merged 1 commit into
develfrom
wasm-unsupported-builtin-error
Sep 22, 2026
Merged

zimri-leisher merged 1 commit into
develfrom
wasm-unsupported-builtin-error

Conversation

@zimri-leisher

Copy link
Copy Markdown
Collaborator

rand(), randf() and set_seed() have no llvm/wasm lowering, and the placeholder generate_llvm raised NotImplementedError — which is neither a CompileError nor a BackendError, so compile_main didn't catch it and the user got a traceback:

$ fprime-fpyc rnd.fpy -d TopologyDictionary.json --emit wasm
...
NotImplementedError: this builtin has no LLVM/wasm lowering yet

generate_llvm now defaults to None and the backend raises a BackendError at the call, so it points at the source like every other backend error:

rnd.fpy:1 the 'rand' builtin is not supported by the wasm backend
     1 | x: U32 = rand()
                  ^^^^^^

It is still a hard error — nothing is silently miscompiled.

…mentedError on wasm

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@zimri-leisher
zimri-leisher marked this pull request as ready for review September 22, 2026 19:11
@zimri-leisher
zimri-leisher merged commit fb730e0 into devel Sep 22, 2026
8 checks passed
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