Commit graph

36604 commits

Author SHA1 Message Date
Anton-4
bf165cdd75
fix #8696 2025-12-22 19:44:29 +01:00
Richard Feldman
4b857fa1cd
Merge pull request #8655 from roc-lang/gc-cache
Clean up cache files periodically
2025-12-21 22:24:03 -05:00
Richard Feldman
c6415d8dc9
Merge pull request #8715 from roc-lang/langref-expressions
Langref: expressions
2025-12-21 18:34:38 -05:00
Richard Feldman
03359e613d Update outline to split out statements.md 2025-12-21 17:40:08 -05:00
Richard Feldman
2f1500a41a Finish expression.md 2025-12-21 17:34:14 -05:00
Richard Feldman
7be6ae4be6 Add expressions.md 2025-12-21 17:07:26 -05:00
Richard Feldman
221b1839bf
Merge origin/main into gc-cache
Resolved conflicts in src/cli/main.zig:
- Updated createUniqueTempDir to use ctx: *CliContext instead of allocs
- Kept cache cleanup via CacheConfig.getVersionTempDir approach
- Added background cache cleanup thread with new Io.init() pattern
- Updated exe_cache_dir to use ctx.arena with getExeCacheDir helper
- Fixed deleteTempDir calls to use ctx.arena

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 16:39:49 -05:00
Jared Ramirez
7dfb689652
Merge pull request #8713 from roc-lang/jared/push-txuwvknxkyzp 2025-12-21 16:20:59 -05:00
Richard Feldman
5028116939
Merge pull request #8714 from roc-lang/langref
Initial langref
2025-12-21 16:20:06 -05:00
Richard Feldman
667085624f Add a note about completeness of the langref 2025-12-21 15:13:20 -05:00
Richard Feldman
5d125e884e Update langref md to match outline 2025-12-21 15:07:34 -05:00
Richard Feldman
db84d06071 Add outline to readme 2025-12-21 15:02:30 -05:00
Richard Feldman
6faab6ca1e Add langref/ 2025-12-21 14:44:24 -05:00
Jared Ramirez
3972c989f5
Add list_append_unsafe 2025-12-21 11:48:09 -05:00
Jared Ramirez
8fd256d220
Add list.map snapshot and use mutable var in impl 2025-12-21 11:48:09 -05:00
Jared Ramirez
44bf01d518
Add try.map_ok and try.map_err 2025-12-21 11:48:09 -05:00
Richard Feldman
a14665e377
Merge pull request #8711 from roc-lang/fix-issue-8708
Fix TypeContainedMismatch when using type alias inside Try
2025-12-20 22:02:02 -05:00
Richard Feldman
c5895f7388
Fix TypeContainedMismatch when using type alias inside Try
The layout store was incorrectly adding alias types to in_progress_vars,
but aliases just continue to their backing type without ever being
"completed" (removed from in_progress_vars). This caused spurious cycle
detection when the same alias was encountered again during layout
computation for a nominal type like Try.

The fix is to skip adding aliases to in_progress_vars since they are
transparent wrappers that immediately continue to their backing type.

Fixes #8708

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 21:45:07 -05:00
Jared Ramirez
3691a92d99
Merge pull request #8709 from roc-lang/jared/push-kykmksrrkvvs
Move rank check to before annotation generation + adjustRank fixes
2025-12-20 19:10:35 -05:00
Jared Ramirez
648757e33a
Remove test file 2025-12-20 17:13:06 -05:00
Jared Ramirez
aa9e7bd71d
Add some comments 2025-12-20 17:13:06 -05:00
Jared Ramirez
4af41808b7
Move rank check to before annotation generation 2025-12-20 17:13:06 -05:00
Richard Feldman
7ae2aa1333
Merge pull request #8704 from roc-lang/cor-mono
Add Roc emitter and monomorphization infrastructure
2025-12-19 20:19:25 -05:00
Richard Feldman
7e5d219cdb
Fix unused variable suppressions and forbidden @enumFromInt(0)
- Remove unused `self` parameter from Monomorphizer.monomorphize placeholder
- Remove unused `lookup` capture in RocEmitter e_lookup_external handler
- Replace @enumFromInt(0) with undefined for variant_var/ext_var in test

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 18:30:48 -05:00
Richard Feldman
24dc77ab16
Add roundtrip verification tests for emitted Roc code
This adds tests that verify emitted Roc code produces the same results
as the original when run through the interpreter:

- evalToInt/evalToBool helpers for evaluating expressions
- Roundtrip tests for:
  - Integer literals
  - Arithmetic expressions
  - If expressions
  - Boolean True/False
  - Complex arithmetic

The tests parse source, emit it as Roc code, re-parse the emitted code,
run both through the interpreter, and verify they produce identical results.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 14:15:22 -05:00
Richard Feldman
7b42571799
Add Roc emitter and monomorphization infrastructure
This adds the foundation for the monomorphizing compiler:

- RocEmitter: Converts CIR (Canonical IR) to valid Roc source code
  - Handles all expression types (numbers, lambdas, records, tags, etc.)
  - Handles patterns and statements
  - Unit tests for basic expression emission

- Monomorphizer: Infrastructure for specializing polymorphic functions
  - Type hash computation for specialization keys
  - Specialized name generation
  - Integration with type system

- End-to-end tests in eval module:
  - Parse -> Canonicalize -> Type Check -> Emit pipeline
  - Tests for identity function, blocks, and basic expressions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 14:10:47 -05:00
Fabian Schmalzried
21c4cd5dfc
Improve render helper to render lists of tags correctly (#8702)
Improve render helper to render list content correctly
2025-12-19 10:32:33 +01:00
Luke Boswell
576feb3b26
Merge pull request #8629 from roc-lang/implement-box
Implement `Box` builtin
2025-12-19 13:10:16 +11:00
Jared Ramirez
54f0045112
Update snapshots 2025-12-18 12:42:33 -05:00
Jared Ramirez
ee9a76d80c
Add nice error messages 2025-12-18 12:11:03 -05:00
Jared Ramirez
985ce728d5
Revert rank change + required type alias strategy 2025-12-18 11:16:50 -05:00
Anton-4
d4d1c9d0c4
Fix #8699 (#8701) 2025-12-17 19:54:17 +01:00
Matthieu Pizenberg
0392a93d1b
Implement bitwise shifts (#8469)
* Implement bitwise shifts

Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com>

* Add low_level_interp shift tests

Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com>

* Fix wrong test

Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com>

* Use appropriate byte size for shifts

Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com>

* Simplify shift left and right interpreter

Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com>

* Factorize the num_shift_right_zf_by in interpreter

Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com>

* Add edge cases tests for shifts

Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com>

* Fix an edge case test

Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com>

* Truncate shift left to the correct precision

Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com>

* Add shift operators to the borrow switch

Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com>

* restore accidental deletions

---------

Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com>
Co-authored-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2025-12-17 19:32:38 +01:00
Anton-4
2c3fb53a57
output msg if roc build succeeds (#8700) 2025-12-17 17:14:23 +01:00
Anton-4
aad17ac6bf
fix if else fmt without {} (#8698) 2025-12-17 16:36:17 +01:00
Luke Boswell
a6601b542c
try fix return pointer alignment mismatch 2025-12-17 22:41:23 +11:00
Anton-4
49a7f53600
more windows unicode fixes (#8697) 2025-12-17 12:35:22 +01:00
Luke Boswell
58ecb6952f
use e_crash for hosted functions 2025-12-17 21:35:42 +11:00
Luke Boswell
8c75408a0d
Merge pull request #8695 from roc-lang/cli-err-reporting
Refactor cli
2025-12-17 21:21:44 +11:00
Luke Boswell
f6430cb5c6
Merge remote-tracking branch 'remote/cli-err-reporting' into implement-box-with-cli-err-reporting 2025-12-17 15:28:54 +11:00
Luke Boswell
08e798f080 fix handles the InvalidUtf8 error from utf8ToUtf16LeAllocZ calls in the Windows handle inheritance 2025-12-17 14:44:25 +11:00
Luke Boswell
6f7a294150
fix test lint for Windows 2025-12-17 14:35:34 +11:00
Luke Boswell
42937e1728
fix windows targets for test platforms 2025-12-17 14:35:16 +11:00
Luke Boswell
d0b451fb78
start re-organizing, leave a plan for future PR's 2025-12-17 14:33:52 +11:00
Luke Boswell
6a1086e0a9
migrate IO to ctx, add new violation check 2025-12-17 14:03:22 +11:00
Richard Feldman
12dac2cec7
Merge pull request #8669 from roc-lang/fix-issue-8666
Fix panic when using polymorphic numeric as list index
2025-12-16 21:24:55 -05:00
Luke Boswell
0cfbf2a6c4
WIP - ctx migration 2025-12-17 13:09:31 +11:00
Luke Boswell
c64502f88d
WIP migrate ctx 2025-12-17 12:23:48 +11:00
Luke Boswell
a54ed1cf15
WIP - migrate ctx 2025-12-17 11:56:04 +11:00
Luke Boswell
b411657a07
WIP - more ctx migrations 2025-12-17 11:42:34 +11:00