Skip to content

fix: guard runner against fn-proxy last_val#24

Merged
kollhof merged 1 commit into
mainfrom
fix/runner-main-arg-and-formatlastval
May 7, 2026
Merged

fix: guard runner against fn-proxy last_val#24
kollhof merged 1 commit into
mainfrom
fix/runner-main-arg-and-formatlastval

Conversation

@kollhof

@kollhof kollhof commented May 7, 2026

Copy link
Copy Markdown
Member

Summary

  • Fix wasm trap ("No default value") when a fink module's last expression is a closure — formatLastVal now treats function explicitly and falls back safely instead of invoking the fn-proxy via String(v).
  • Add esbuild sourcemaps for both bundles to enable proper devtools debugging.
  • Bump wasm-bindgen 0.2.120 → 0.2.121 (patch).

Test plan

  • Build clean (make build)
  • Run a program whose last top-level expression is a main = fn ... binding — no trap, runner reports last = fn and then main → ...
  • Run a program ending in a numeric/string expression — still works
  • Verify sourcemaps load in browser devtools

The playground runner trapped with "No default value" when a fink module's
last expression was a closure (e.g. a `main = fn ...` binding with nothing
trailing). `formatLastVal` fell through to `String(v)`, which invoked the
fn-proxy and tripped wasm.

Treat fn values explicitly in `formatLastVal` (return 'fn'), and add a safe
fallback for unknown values. Module-level `main(...)` invocation is kept
and now runs only when `main` is actually a callable export.

Also enable esbuild sourcemaps for both bundles, and bump wasm-bindgen
0.2.120 → 0.2.121 (patch).
@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown

This PR will release v1.16.1

@kollhof kollhof merged commit e1a14da into main May 7, 2026
2 checks passed
@kollhof kollhof deleted the fix/runner-main-arg-and-formatlastval branch May 7, 2026 11:22
@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.16.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant