Commit graph

36539 commits

Author SHA1 Message Date
Luke Boswell
3a333c2187
exports (not all_defs) to only include exported definitions as entry
points
2025-12-17 09:05:03 +11:00
Luke Boswell
7379f5d18a
print compilation errors for roc build too 2025-12-17 08:26:11 +11:00
Luke Boswell
2edc1f4c86 fix windows targets for test platforms 2025-12-16 23:12:39 +11:00
Luke Boswell
9e79f3f924 fix test lint for Windows 2025-12-16 22:59:52 +11:00
Luke Boswell (Linux-Desktop)
83266eb7b0
merge changes from remote/main 2025-12-17 06:57:47 +11:00
Richard Feldman
82673a0f76
Merge pull request #8690 from roc-lang/fix-issue-8689
Fix field access on record payload in tag union wrapped by opaque type
2025-12-16 13:35:32 -05:00
Hubert Małkowski
2937d64456
Show test summary without --verbose flag (#8554) (#8691)
* 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>
2025-12-16 19:10:48 +01:00
Anton-4
7758b8d686
retry on timeout
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2025-12-16 18:28:44 +01:00
Anton-4
4708a1f52f
retry on gateway timeout
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2025-12-16 18:26:27 +01:00
Anton-4
8cbd6034ec
fix non-printable unicode carriage return windows (#8692) 2025-12-16 18:18:55 +01:00
Anton-4
f3f80d2a2c
retry on downloadToFile error
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2025-12-16 18:18:18 +01:00
Richard Feldman
03535a5786
Convert fx test to eval snapshot test for issue #8689
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>
2025-12-16 12:14:25 -05:00
Fabian Schmalzried
22159f2c5c
Add List.repeat builtin (#8688)
* Add List.repeat builtin

* format Builtin.roc
2025-12-16 14:27:51 +01:00
Richard Feldman
641f4db0b0
Update snapshots for nominal pattern bound variable fix
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>
2025-12-16 07:55:22 -05:00
Richard Feldman
9f143f79ec
Fix nominal pattern bound variable collection (issue #8689)
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>
2025-12-16 07:53:38 -05:00
Fabian Schmalzried
bb52264221
Grow arrays exponentially (#8682)
* 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>
2025-12-16 13:38:20 +01:00
Luke Boswell
7b31e3204c
fix recursive addTypeVar corrupting work stack
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>
2025-12-16 22:32:28 +11:00
Anton-4
43dd3d9ed0
Add 'Timeout' for retries
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2025-12-16 12:23:20 +01:00
Luke Boswell
15966a2525
fix nominal pattern binding in method blocks
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>
2025-12-16 21:00:02 +11:00
Luke Boswell
2ee19eeb57
handle dot_access_resolve receiver is a record with callable field 2025-12-16 19:15:03 +11:00
Luke Boswell
1b68e035b0
replace unreachable with debug helper in interpreter 2025-12-16 17:46:58 +11:00
Luke Boswell
e9ecd840c5
fix parallel build race condition with content-hashed shim files
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>
2025-12-16 17:16:13 +11:00
Luke Boswell
cd6a5900c6
fix multi-module platform exposes and add str platform tests
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>
2025-12-16 17:10:56 +11:00
Luke Boswell
0a6817b72e
expand scope of @panic purge 2025-12-16 16:16:04 +11:00
Luke Boswell
f20e945cb9
fix tests 2025-12-16 13:33:53 +11:00
Luke Boswell
19c6bf4078
purge @panic from the interpreter - use roc crash instead 2025-12-16 13:05:46 +11:00
Luke Boswell
d39bf80ec0
implement module tracing on WASM 2025-12-16 12:40:53 +11:00
Luke Boswell
fba022121c
improve tests for module dependency ordering 2025-12-16 11:48:15 +11:00
Luke Boswell
2bdbe87be0
add trace_modules feature 2025-12-16 11:25:17 +11:00
Luke Boswell
d499420a0f
cleanup doc comments 2025-12-16 10:35:39 +11:00
Luke Boswell
132658fa15
fix: transitive module imports in compile-time evaluation
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>
2025-12-16 10:21:46 +11:00
Luke Boswell
ca91ee3498
fix: skip vars with rank changed by unification during generalization
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>
2025-12-16 08:21:17 +11:00
Luke Boswell
0edb5fe2df
Merge remote-tracking branch 'remote/fix-issue8654' into implement-box 2025-12-16 07:29:48 +11:00
Luke Boswell
7694fc5d42
Merge remote-tracking branch 'remote/main' into implement-box 2025-12-16 07:17:45 +11:00
Anton-4
77cc6ee924
Add 'Timeout' for retry logic
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2025-12-15 19:49:45 +01:00
Anton-4
113fff55a2
fix #8654 2025-12-15 19:39:01 +01:00
Anton-4
60336fd1a5
expand all_syntax_test (#8685) 2025-12-15 19:20:23 +01:00
Brendan Hansknecht
730193e6ed
Merge pull request #8684 from roc-lang/bhansconnect/push-tsrtrtqmlozt
default to tracy_callstack off
2025-12-15 09:45:27 -08:00
Brendan Hansknecht
8e8e6d9848
default to tracy_callstack off
It is just super slow and expensive to have all the time
2025-12-15 09:05:49 -08:00
Anton-4
27baa11f11
don't ask to report issue for old compiler (#8683)
* dont report issue old compiler

* Increase timeout

Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>

---------

Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2025-12-15 17:01:43 +01:00
Richard Feldman
eb2dacd701
Merge pull request #8681 from roc-lang/bhansconnect/push-sqorvksomyon
avoid hot loop memset
2025-12-15 08:05:40 -05:00
Luke Boswell
ef798cc401
lookup for transitory modules 2025-12-15 21:56:15 +11:00
Luke Boswell
79c0cbb04b
Merge remote-tracking branch 'remote/main' into implement-box 2025-12-15 20:01:23 +11:00
Luke Boswell
3e9008251d
fix infinite recursion bug (again) 2025-12-15 19:57:09 +11:00
Brendan Hansknecht
283f04f1d0
avoid hot loop memset
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.
2025-12-15 00:57:08 -08:00
Brendan Hansknecht
c4a4850a08
Merge pull request #8680 from roc-lang/bhansconnect/push-xqqstwnkvopp
update tracy hooks
2025-12-15 00:54:53 -08:00
Brendan Hansknecht
cfc42703c7
update tracy hooks
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
2025-12-15 00:22:16 -08:00
Luke Boswell
4e4eef2d04
fix infinite recursion bug (again) 2025-12-15 15:18:49 +11:00
Luke Boswell
0016bb1a04
fix infinite recursion bug 2025-12-15 12:47:24 +11:00
Luke Boswell
2922ab9ef0
fix cross-module opaque type lookup 2025-12-15 12:32:55 +11:00