Commit Graph

3537 Commits

Author SHA1 Message Date
Christoffer Lerno
a004cd3d03 Lambdas on the top level were not exported by default. #2428 2025-08-23 19:40:18 +02:00
Christoffer Lerno
768ce6092d @tag was not allowed to repeat. 2025-08-23 18:42:57 +02:00
Christoffer Lerno
e4e499edd2 Allow $defined take declarations: $defined(int x = y)
Taking the address of a label would cause a crash. #2430
2025-08-23 12:00:17 +02:00
Christoffer Lerno
f36e9fea48 Types converts to typeid implicitly. 2025-08-22 00:26:18 +02:00
Christoffer Lerno
d5eec296a0 Some cleanup. 2025-08-21 17:06:06 +02:00
Christoffer Lerno
e2e2ca1d7f Add @safeinfer to allow var to be used locally. 2025-08-21 12:39:08 +02:00
Christoffer Lerno
6ab7198f2f - Added AsciiCharset for matching ascii characters quickly.
- Added `String.trim_charset`.
2025-08-21 02:57:17 +02:00
Christoffer Lerno
2e1f7c95ce Cleanup. 2025-08-21 01:46:41 +02:00
Christoffer Lerno
a2ef63f5b6 Error if a stack allocated variable is too big (configurable with --max-stack-object-size). 2025-08-21 00:33:56 +02:00
vssukharev
b7c9a4e2e9 Several fixes for the compiler (#2422)
* Update .gitignore for nix

* Fix build failure when compiling with -Werror=maybe-uninitialized

* Fix test failure formatting

* Add separateDebugInfo to c3c Nix build
2025-08-20 21:47:22 +02:00
Christoffer Lerno
28ffb864a3 Deprecated PollSubscribes and PollEvents in favour of PollSubscribe and PollEvent and made them const enums. 2025-08-19 12:20:17 +02:00
Book-reader
18b4ce4e7d fix Socket.get_option calling setsockopt instead of getsockopt (#2421)
* fix Socket.get_option

* `Socket.get_option` didn't properly call `getsockopt`, and `getsockopt` had an invalid signature.

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
2025-08-19 11:36:18 +02:00
Christoffer Lerno
551ce34b9b - foo[x][y] = b now interpreted as (*&foo[x])[y] = b which allows overloads to do chained [] accesses. 2025-08-19 01:57:51 +02:00
Christoffer Lerno
de09a19a48 - Incorrect type checking when &[] and [] return optional values.
- Failed to find subscript overloading on optional values.
- Added `&[]` overload to HashMap.
2025-08-19 00:41:40 +02:00
Manu Linares
ba55946c9a Fixes slicing with negative value error message - llvm_codegen_expr.c (#2410)
* Fixes slicing with negative value error message - llvm_codegen_expr.c

Fixes printing negative value

Example:
```
fn void main()
{
    int[100] arr;
    usz a = 35;
    usz b = 36;
    arr[b:a - b];
}
```

output should be:
ERROR: 'Negative value (-1) given for slice length.'

* Update releasenotes.

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
2025-08-18 23:12:03 +02:00
Christian Brendlin
33ab18033a #2391: Improve missing $endif error message (#2413)
* Improve error message missing

* remove temp comment

* Update releasenotes.md

* Use sema_note to print the "$if" line

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
2025-08-18 23:09:07 +02:00
Christian Brendlin
96127d4ff3 Fix crash when exporting functions with const enums #2384 (#2414)
* headers: handle const enums in exported signatures as base type

* update releasenotes.md

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
2025-08-18 22:49:42 +02:00
Alessandro Mauri
43163fe2a0 Fix out of bounds access when stdout is empty 2025-08-18 22:31:46 +02:00
Christoffer Lerno
a52b30c951 Update releasenotes for fix, which was the previous commit for fixing "Compiler assert when calling unassigned CT functions #2418". Fail :( 2025-08-18 21:29:36 +02:00
Christoffer Lerno
7d6a864d56 Miscompilation of do-while when the while starts with a branch #2394. Also: change do-while to make the lowering follow the execution. 2025-08-18 21:28:19 +02:00
Christoffer Lerno
eeab73df4e Miscompilation of do-while when the while starts with a branch #2394. Also: change do-while to make the lowering follow the execution. 2025-08-18 21:04:52 +02:00
Christoffer Lerno
db45abdfc7 Update releasenotes for #2398 fix. 2025-08-18 13:09:24 +02:00
vssukharev
cb32441533 Temporary fix for #2398 (#2415)
* Temporary fix for #2398

* Update sema_liveness.c

Remove comment

---------

Co-authored-by: Christoffer Lerno <christoffer.lerno@gmail.com>
2025-08-18 13:06:23 +02:00
Christoffer Lerno
643aa47e99 Compiler segfault with struct containing list of structs with an inline member #2416 2025-08-18 12:19:14 +02:00
Christoffer Lerno
5e1bf75621 Updated release notes 2025-08-18 12:03:05 +02:00
Christoffer Lerno
7c8e3dd4fd Fix max module name to 31 chars and the entire module path to 63 characters. 2025-08-18 12:02:00 +02:00
Zack Puhl
ad02fad167 Add Freestanding OS Types (#2399)
* Add Freestanding OS Types to `env::`
2025-08-16 19:47:03 +02:00
Sander van den Bosch
261184b5c1 Add HashSet and String methods (#2386)
* Add `String.contains_char` using `String.index_of_char` and `HashSet.values` together with `HashSet.tvalues`

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
2025-08-16 16:57:31 +02:00
Manu Linares
d07da2804e Update sema_decls.c
Fix compilation error

```
[ 48%] Building C object CMakeFiles/c3c.dir/src/compiler/sema_passes.c.o
/home/mb/.cache/yay/c3c-git/src/c3c/src/compiler/sema_decls.c: In function ‘sema_analyse_operator_method’:
/home/mb/.cache/yay/c3c-git/src/c3c/src/compiler/sema_decls.c:2312:25: error: suggest parentheses around assignment used as truth value [-Werror=parentheses]
 2312 |                         is_wildcard = method->func_decl.is_wildcard_overload = true;
      |                         ^~~~~~~~~~~
```
2025-08-16 16:47:59 +02:00
Zack Puhl
702b63ddb7 Add array::zip and Related Macros (#2370)
* zip / zip_into
* Deprecate `add_array` in favour of `push_all` on lists.
* Add support for generic lists for zip.

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
2025-08-16 13:30:24 +02:00
konimarti
e35dbd29fb string: use correct allocator in replace (#2405)
`replace` accepts an Allocator but uses `mem` instead.
2025-08-16 03:41:59 +02:00
Christoffer Lerno
b52ab886d2 Compiler segfault on global slice initialization with null[:0] #2404. 2025-08-15 20:10:28 +02:00
Christoffer Lerno
4b95d6be4c New method resolution. 2025-08-15 19:48:08 +02:00
Christoffer Lerno
34b0b6f8f9 Fix for bug when @format encountered * in some cases. 2025-08-15 08:26:43 +02:00
Christoffer Lerno
4fea202e6d Added libloaderapi to std::os::win32 2025-08-14 22:11:20 +02:00
Zack Puhl
8cfdb76869 Add benchmarkrun and *.wasm to .gitignore (#2400)
* Add `benchmarkrun` and `*.wasm` to .gitignore
* add .s assembly files too
2025-08-14 20:49:18 +02:00
Christoffer Lerno
858f8d2405 Updating license docs further. 2025-08-14 20:42:07 +02:00
Christoffer Lerno
67aa18c1aa Clarifying license. 2025-08-14 20:40:30 +02:00
Christoffer Lerno
31b15c775e Slicing a constant array with designated initialization would not update the indexes. 2025-08-14 20:27:23 +02:00
Zack Puhl
bf7e7e2397 Fix Benchmark Progress Printing (#2401) 2025-08-14 20:24:37 +02:00
Zack Puhl
eb8fb8871f Fix $$str_hash to use a5hash like String.hash() (#2403)
* Fix `$$str_hash` to use `a5hash` like `String.hash()`
2025-08-14 20:24:01 +02:00
Christoffer Lerno
85dc9c45ab - Deprecate @compact use for comparison. Old behaviour is enabled using --use-old-compact-eq.
- Switch available for types implementing `@operator(==)`.
- `Type.is_eq` is now true for types with `==` overload.
- Functions being tested for overload are now always checked before test.
- Compile time indexing at compile time in a $typeof was no considered compile time.
2025-08-14 15:53:35 +02:00
Book-reader
076ef187cb improve & fix libc termios bindings (#2372)
* improve & fix libc termios bindings
2025-08-13 17:24:41 +02:00
Zack Puhl
c8d39251a9 Add compile-time @min and @max (#2378)
* Add compile-time `@min` and `@max`
2025-08-13 17:23:24 +02:00
Christoffer Lerno
f5e6b697b8 Make @try maydiscard. 2025-08-13 13:31:29 +02:00
Christoffer Lerno
e8e88c1920 Merge branch 'dev' 2025-08-13 13:30:47 +02:00
Christoffer Lerno
82a58e1c66 Update libc memcpy. 2025-08-13 13:29:56 +02:00
Velikiy Kirill
8e8d0436ad Add epoll bindings to std::os::linux + misc (#2350)
* Add epoll to std::os::linux + misc

* Fix import in linux.c3

* epoll: Add unit tests

* epoll: Fix imports in unit tests

* epoll: Add libc import
2025-08-13 02:41:09 +02:00
Christoffer Lerno
db99de9717 Improve codegen for stack allocated large non-zero arrays. 2025-08-12 17:01:39 +02:00
tonis2
fd9fbe26a1 JSON parser trailing issue fix 2025-08-12 16:19:41 +02:00