Commit Graph

1697 Commits

Author SHA1 Message Date
Christoffer Lerno
dd8449576f - Passing a non-conststring to module attributes like @cname would trigger an assert rather than printing an error.
- Passing different types to arg 1 and 2 for $$matrix_transpose would trigger an assert.
- Zero init of optional compile time variable would crash the compiler.
- Using multiple declaration for generics in generic module would fail.
- Defining an extern const without a type would crash rather than print an error.
- Typedef followed by brace would trigger an assert.
- Union with too big member would trigger an assert.
2026-01-18 22:47:17 +01:00
Christoffer Lerno
c3b2694834 Generics with <>. Deprecation of {} generics. 2026-01-18 00:33:43 +01:00
Christoffer Lerno
a326e31e57 Add missing fix. 2026-01-17 18:52:55 +01:00
Christoffer Lerno
945a3f3fc0 Add mem::store and mem::load which may combine both aligned and volatile operations. 2026-01-17 18:52:30 +01:00
Christoffer Lerno
6dcd91c5ef - Assert on defining a const fault enum with enumerator and fault of the same name. #2732 2026-01-17 15:01:40 +01:00
Christoffer Lerno
c2e603ddd8 Expand inference. 2026-01-17 14:03:58 +01:00
Christoffer Lerno
70c4b24519 - In some cases, a type would not get implicitly converted to a typeid #2764. 2026-01-16 11:41:18 +01:00
Christoffer Lerno
51364a9d1b Another fix in immediately rethrowing a value in an assignment #2689 2026-01-15 23:33:26 +01:00
Book-reader
cd2d1a04d8 Use a Printable struct for ansi rgb formatting instead of explicit allocations (#2696)
* Use a `Printable` struct for ansi rgb formatting

* update release notes

* Some renaming.

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
2026-01-15 22:26:18 +01:00
Zack Puhl
3f7a547d8a Merge AsciiCharset CT/non-CT Functions (#2688)
* Merge AsciiCharset CT/non-CT Functions

* release notes

* incorporate helpful review feedback

* re-separate 'create_set' and 'contains' but keep 'combine_sets'; update tests

* tabs (annoying IDE)

* Restored old code verbatim for smaller diff. Split combine_sets into easier to macro/function for runtime / macro version, this also allows for more easy type checks.

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
2026-01-15 21:39:48 +01:00
Manu Linares
f254c27966 std/io/os/temp_directory.c3: fix INVALID_PATH in Win32 native_temp_directory (#2762)
* std/io/os/temp_directory.c3: fix INVALID_PATH in Windows native_temp_directory

- Use the actual length from GetTempPathW for Windows temp path slice
- We can remove the workaround in the test_suite_runner for WIN32 and
create all directories in %temp% now

* Updated releasenotes.

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
2026-01-15 21:23:30 +01:00
Christoffer Lerno
7f297a9d27 Fix type inference overrides parameterization #2761. Remove support for ^io::EOF 2026-01-15 15:19:33 +01:00
VarunVF
64ef33f09b Require parenthesized assignment expressions in condition of 'if' statements #2716 (#2729)
* Require parenthesized assignment expressions in condition of 'if' statements #2716

* Move analysis to semantic checker and also check while. And update tests and release notes.

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
2026-01-15 00:43:58 +01:00
mikelgarai
cd4c586c3f Fixed macro hash_vec(vec): it was checking only the first bytes (4 or 8, not sure) (#2718)
* Fixed macro hash_vec(vec): it was checking only 8 bytes

* use $sizeof() directly as it is correct now

* Added unit test for vector types

Tests that hashes match for same values and that they don't match
when changing a single bit on any of the vector elements

* Changed hardcoded value for the compiler option

* Release note

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
2026-01-14 23:22:10 +01:00
Manu Linares
04eb6fc451 CI: Major refactor, expanded coverage, and ~80% speedup (#2736)
* netbsd fail on error

- Group each BSD test in its own subshell. Without this, if an error
occurs, it exits, but we don't know "where" it failed
- added *usesh: true* to BSD for faster copying into the virtualbox VM

- Some test_suite_runners wheren't correctly printing. added
--no-terminal
- For testing I've changed *build-msvc* from Debug to RelWithDebInfo

Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>

* separate runs

Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>

* fix typo

Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>

* Split msvc-debug into separate workflow

Run msvc-debug only on maintainer pushes, keep CI fast and still catches
errors.

Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>

* Fix build and test errors on NetBSD

* Set proper sizes for various types used for threads
* Add num_cpu function
* Add sysctl constants
* Allow testproject to build on NetBSD
* Tweaks to the linker code so that it adds correct flags and finds dynamic linker on NetBSD

* bsd: force system linker test

Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>

* system linker on openbsd

remove lld from netbsd

Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>

* use cc linker in openbsd, and re-add lld for netbsd

Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>

* openbsd: fixes

- implement num_cpu() for OPENBSD
- testproject: add openbsd
- linker.c: fix for openbsd
- bsd refactor main.yml and more fixes

* openbsd: fix for unit tests and test_suite_runner

openbsd now passes all tests except the 'dynlib-test' which yields
'relocation error' when running `cc test.c -L. -ladd -Wl,-rpath=.`

Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>

* openbsd: guard/disable unit test test_ct_intlog2()

* build-msys2-clang: add all tests that build-msvc has

Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>

* Fix Windows import library generation by adding /IMPLIB support and properly declaring static_lib_name()

Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>

* build-msys2-mingw: add all tests that build-msvc has and enable it

configure CMake to link LLVM and LLD statically

* Revert "Revert windows"

This reverts commit 197f82d829.

* win-llvm 21.1.8

uses the RelWithDebInfo+Assertions

* refactor(CI): Centralize test logic and fix Docker execution

This commit refactors the GitHub Actions workflow to improve
maintainability and correct a flaw in the Docker build.

- Ensures Docker based tests run *inside* the generated container, not
on the host. This also fixes environment isolation and user permission
errors.
- Centralizes all common test steps (examples, libs, unit tests, etc)
into a single, auto-detecting Bash script: `scripts/tools/ci_tests.sh`.
- Centralize all release artifact packaging into a single
`scripts/tools/package_build.sh`
- fixes using correct paths for test_suite_runner when running on
windows under bash.

- This significantly reduces YAML duplication, making `main.yml` more
readable and easier to maintain.

This one supersedes pull/2677, and includes the fixes for:

- fix openbsd and netbsd
- added win-llvm 21.1.8 and fixed CMakeLists.txt
- added full unit-tests and suite for build-msys2-mingw and
build-msys2-clang

* macos: add/fix build for llvm (19,20,21)

Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>

* ci: run tests in temp dir to avoid workspace pollution

Executes ci_tests.sh in a disposable temporary directory by copying
resources/ and test/ folders, preventing build artifacts from cluttering
the source tree.

This makes it easy to run `scripts/tools/ci_tests.sh` locally on any
platform.

Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>

* add ilammy/msvc-dev-cmd@ and Ninja

we can simplify the windows runner and run everything in bash

Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>

* windows: drain subprocess stderr before join to avoid test_suite_runner hang

* move last test to `ci_tests.sh`

thus completing the centralization of tests in `ci_tests.sh`

* Fix Windows CI cache

Updates the cache key to include hashes of CMakeLists.txt and the
workflow file.

Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>

* `package_build.sh` runs in temp dir to avoid workspace pollution

- add cleanup

* nix: use `ci_tests.sh`

* remove annoying build-mac warnings

This now checks if package already installed trying to prevent
annoying warnings in the github ci:

Fixes:
```
build-mac (Release, 19)curl 8.17.0 is already installed and up-to-date.
To reinstall 8.17.0, run: brew reinstall curl
```

* refactor test_suite_runner

- less allocations, cleaner code, more maintainable.
- now can be killed and the temp dirs are correctly cleaned up, and the
output is correct.

* main.yml: bsd: change to using rsync, is twice as fast.

* default to `--wincrt=dynamic` when `--sanitize=address` on windows

Default to dynamic, as static ASan is removed in LLVM 21+ for Windows
https://github.com/llvm/llvm-project/pull/107899

Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>

* Formatting (indent with tab, align with space). Fix K&R braces. Style: keep all cases multiline if one is.

---------

Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
Co-authored-by: Alex Garrett <limit.ordinal17@gmail.com>
2026-01-14 01:16:06 +01:00
Book-reader
c73c7cb2a3 add Win32_CODEPAGES enum and enable utf8 console output on win32 (#2670)
* add Win32_CODEPAGES enum and enable utf8 console output on win32

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
2026-01-13 23:00:01 +01:00
Arnaud Duforat
87c42f1cd3 Add unit tests for HMAC 256 based on RFC 4231 (#2744)
* Add unit tests for HMAC 256 based on RFC 4231

* Formatting, shorten initializers.

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
2026-01-12 11:26:49 +01:00
Christoffer Lerno
e93f22fbda - bitorder::read and bitorder::write may fail because of unaligned access #2734. 2026-01-12 01:11:31 +01:00
Christoffer Lerno
0fc1871ddf - Assert on optional-returning-function in a comma expression. #2722 2026-01-07 15:53:54 +01:00
Christoffer Lerno
6d53fd6f6e Fix test. 2026-01-07 03:18:01 +01:00
Christoffer Lerno
e0771beabc Remove pointer names in debug, following Clang. 2026-01-07 02:35:05 +01:00
Christoffer Lerno
824d064710 Fix tests. 2026-01-07 00:55:30 +01:00
Christoffer Lerno
9ad98beda7 - Crash when doing a type property lookup for const inline enums in some cases #2717. 2026-01-06 15:28:18 +01:00
Christoffer Lerno
702f836b40 io::read_fully now handles unbounded streams properly 2026-01-05 22:27:55 +01:00
Christoffer Lerno
d820a2356a Fix: Compiler assert when attempting to define multiple faults in a generic module. #2706 2026-01-05 21:04:23 +01:00
Christoffer Lerno
fa1951642b Add debug info 2026-01-05 00:11:48 +01:00
Christoffer Lerno
42dc2d541a Add testcase. 2026-01-04 22:05:01 +01:00
Christoffer Lerno
292bf1cbbc Designated initialization with ranges would not error on overflow by 1. 2026-01-03 02:32:40 +01:00
Christoffer Lerno
82769669ec Fix of generic with multiple parameters fail. #2702 2026-01-03 00:09:14 +01:00
Zack Puhl
e4965ab408 Add BLAKE3 Hashing/XOF to stdlib (#2667)
* blake3: initial unit test passing!

* typo

* add key derivation macros; vanilla unit tests; working to test 18 atm

* mark it here - all tests passing o_o

* finish first-round unit tests - will add more if necessary

* add crypto shootout bench entertainment

* tests: add XOF unit w/ seek; assert NO finalization

* add another to finalizations unit test

* add all BLAKE3 scaffolding for later SIMD optimizations

* irksome

* tabs

* tabs2

* extra documentation / contracts

* extra detail

* try to make things a bit more arch-neutral

* release notes

* Formatting

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
2026-01-01 21:11:33 +01:00
Christoffer Lerno
739e91efa4 - Reduced memory usage for backtraces on Linux.
- `String.tokenize_all` would yield one too many empty tokens at the end.
- `String.replace` no longer depends on `String.split`.
2025-12-31 10:08:00 +01:00
Christoffer Lerno
04706f2dcd Fix issue when removing test files on abort. 2025-12-31 00:13:38 +01:00
Christoffer Lerno
d8a7c57b56 - Miscompilation: global struct with vector could generate an incorrect initializer. 2025-12-30 23:54:00 +01:00
Christoffer Lerno
d51dd09a1f Made contracts aggregate from types etc 2025-12-30 21:31:45 +01:00
Christoffer Lerno
5ed4f9519f - x'1234' +++ (ichar[1]) { 'A' } would fail due to missing const folding. 2025-12-30 16:06:28 +01:00
Christoffer Lerno
493a084745 Added additional type size limits. 2025-12-30 13:42:14 +01:00
Christoffer Lerno
9bd04526e8 foo.x was not always handled correctly when foo was optional. 2025-12-30 12:38:04 +01:00
Christoffer Lerno
90f0486334 - Assert when encountering a test function with raw vaarg parameters. 2025-12-30 12:28:03 +01:00
Christoffer Lerno
e4f1b57bd0 Assert when encountering a malformed module alias. 2025-12-29 22:41:42 +01:00
Christoffer Lerno
c949bd3108 Assert when struct size would exceed 4 GB. 2025-12-29 22:24:41 +01:00
Christoffer Lerno
56f8008d85 - Parse error in $defined was not handled correctly, leading to an assertion. 2025-12-29 22:09:39 +01:00
Christoffer Lerno
328e6f518c Fix bug when encountering Type{} where Type is a generic parameter. 2025-12-29 19:34:45 +01:00
Christoffer Lerno
8ec4a2cada Fix test. 2025-12-29 17:25:49 +01:00
Zack Puhl
9b318ec233 [stdlib] Impove SHA-256 Performance (#2671)
* [stdlib] Impove SHA-256 Performance

Cleaned up the code a bit. Seems to have improved performance anywhere from ~10-25%.

* trade-offs, trade-offs... reduce codegen

* Fix formatting

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
2025-12-29 17:07:03 +01:00
Christoffer Lerno
d96624c578 Decoupled generics (#2695) 2025-12-29 17:01:03 +01:00
Christoffer Lerno
bf1d401566 Converting between simd/non-simd bool vector would hit a compiler assert. #2691 2025-12-29 16:59:34 +01:00
Christoffer Lerno
a2c886a2d9 - Compiler assert when passing returning CT failure immediately rethrown #2689. 2025-12-26 22:02:02 +01:00
Christoffer Lerno
e76278cfd7 Fix test 2025-12-25 22:50:06 +01:00
Christoffer Lerno
1028f85daa - Better error messages when slicing a pointer to a slice or vector. #2681 2025-12-25 22:01:15 +01:00
Christoffer Lerno
e706c914a8 Fix test. 2025-12-25 21:39:19 +01:00