* show test summary without --verbose flag (#8554)
* remove outdated comments
* shorten passed msg
---------
Co-authored-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
The eval snapshot test is faster and more appropriate since the bug
is in the canonicalization phase. The test verifies both that the
code canonicalizes correctly (no incorrect captures) and that it
evaluates correctly at runtime.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The fix correctly identifies that variables bound inside nominal
patterns (like `s` in `Container.Box(s)`) are bound in the pattern
scope and don't need to be captured. This results in cleaner
canonical IR where functions that use nominal pattern matching
are now represented as pure lambdas instead of closures with
unnecessary captures.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
collectBoundVarsToScratch was not recursing into the backing pattern
for nominal and nominal_external patterns. This caused variables
bound in nominal patterns (e.g., Wrapper.Simple(s)) to not be tracked
as bound variables, leading to them incorrectly being included in the
free variables of match expression bodies.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Grow arrays exponentially
This leads to a speedup for AoC code from ~19s to ~300ms
* Grow ArrayListMap the same was as std.ArrayList
* Let ArrayList do the growing for var_to_layout_slot
---------
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
Co-authored-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
The layout computation's addTypeVar function was clearing work fields
(pending_record_fields, pending_tuple_fields, pending_tags, etc.) at
the start of every call via clearRetainingCapacity(). This caused
corruption when processing nested types that trigger recursive calls.
Example problem case:
{ tag: Str, attrs: List([StringAttr(Str, Str), BoolAttr(Str, Bool)]) }
When processing this record:
1. Record handling pushes fields to pending_record_fields
2. Processing the List element triggers tag union handling
3. Tag union handling makes recursive addTypeVar calls for variant payloads
4. These recursive calls cleared pending_record_fields
5. When returning to finalize the outer record, pop() found empty stack
The fix removes clearRetainingCapacity entirely. All work fields now
persist across recursive calls and are cleaned up individually:
- pending_containers: pop() when container layout is finalized
- in_progress_vars: swapRemove() when type is cached
- pending_record_fields: pop() when field is resolved
- pending_tags: shrinkRetainingCapacity() via defer
This fixes the unreachable panic in roc-dom when rendering elements
with complex nested types like List([String(Str,Str), Bool(Str,Bool)]).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Two related issues were preventing methods with nominal patterns like
`|Widget.Content(s)|` from working:
1. In the canonicalizer, `collectBoundVarsToScratch` wasn't recursing
into `.nominal` and `.nominal_external` patterns, causing variables
bound inside them (like `s`) to be incorrectly treated as captures
instead of pattern-bound variables.
2. In the interpreter, no-args method dispatch was directly appending
bindings without using `patternMatchesBind`, which meant nested
patterns weren't properly bound. The body's `e_lookup_local` would
look for a `p-assign` pattern_idx but only find the outer `p-nominal`.
The fix makes both cases properly recurse into nominal patterns to find
and bind all nested pattern variables.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The platform shim generation was writing to fixed filenames (platform_shim.bc
and platform_shim.o) in the shared cache directory, causing race conditions
when multiple builds ran in parallel.
Fix: Include a CRC32 hash of the serialized module content in the shim
filenames. Each unique module content now gets its own shim files, allowing
parallel builds to proceed without interfering with each other.
Also:
- Remove obsolete wasm-elem test platform from build.zig
- Update CLI tests to run in parallel instead of sequentially
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fix a bug where platforms exposing multiple modules would fail at runtime
with "nested value not found" errors when modules call each other's methods.
Root cause: compileAndSerializeModulesForEmbedding was passing module names
in the wrong order (exposed_modules.items vs sorted_modules), and wasn't
passing type module names when compiling sibling platform modules.
Changes:
- src/cli/main.zig: Pass sorted_modules as type module names when compiling
platform modules, platform main, and app modules
- src/eval/interpreter.zig: Improve error messages for nested_value_not_found
- src/canonicalize/Can.zig: Add trace output for nested_value_not_found
Test infrastructure:
- Add SimpleTestSpec and simple_list variant to platform_config.zig
- Add 8 str platform tests covering direct calls, transitive calls, and
diamond dependency patterns
- Update test_runner.zig to handle simple_list
- Add test_runner invocations for int and str platforms to build.zig
- Make CLI tests run sequentially to avoid cache race conditions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fix "TypeMismatch in body evaluation" panic when platform modules make
transitive calls (e.g., app → Helper → Core).
Changes:
- Pass sibling modules during platform module compilation so each module
can resolve imports to previously compiled siblings
- Detect type modules (using `:= [].{}` syntax) and set statement_idx
for proper qualified name lookup during canonicalization
- Pre-allocate compiled_modules ArrayList to avoid pointer invalidation
during reallocation
- Add fallback to env.imports.getResolvedModule in evalLookupExternal
for cross-module calls when current module context has changed
- Fix use-after-free bug in low_level_interp_test.zig by heap-allocating
imported_envs array
- Add integration test for transitive module imports
Note: Modules must be listed in dependency order in the platform's
exposes list (e.g., if Helper imports Core, Core must come before Helper).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When a type variable was added to var_pool at one rank but later unified
with a variable at a higher rank, the resolved var's rank could exceed
the rank being generalized. This caused a panic: "trying to add var at
rank 2, but current rank is 1".
Two changes fix this:
1. In generalize.zig: Skip vars whose resolved rank is higher than
rank_to_generalize. They will be handled when generalizing at their
actual rank.
2. In Check.zig: Don't re-add substitution vars (from substitute_rigids)
to var_pool during instantiation. These vars were already added when
the annotation was processed, and their rank may have changed.
This fixes the bug where List.map with a top-level function that returns
an external parameterized type (like `Elem.Elem(Model)`) caused a
compiler panic during type generalization.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Instead of memsetting back to zero, use a generation tag.
This avoids collisions while also avoiding O(n) cost.
This is fundamental for interpreter perf over time.
Properly add tracy to the interpreter shim (requires linking c++ when tracy is enabled.
Add tracy hooks to way more functions,
Wrap more zig allocators with tracy hooks.
Add tracy hooks to the roc_ops and allocations.
Also, tracy callstack now works on macos