Christoffer Lerno
bc9b0900a5
- Inlining a const as an lvalue would take the wrong path and corrupt the expression node.
2025-08-25 15:26:47 +02:00
Christian Brendlin
f43a7540c5
clarify directory creation error messages ( #2388 )
...
* Improve error messages for project creation
---------
Co-authored-by: Christoffer Lerno <christoffer@aegik.com >
2025-08-25 14:56:59 +02:00
Zack Puhl
410a25f334
Add array @reduce, @filter, @any, @all, & @indices_of ( #2419 )
...
* wip: array reduce and any/all
* wip: continue adding more functional-like array module functions
* wip: documentation and other fixes
* finish unit tests, require INDEX variable in lambdas, ready for first review
* don't worry about iterating by ref (it wasn't passing it that way anyhow)
* update release notes again
* simplify, remove "summary operators" and related tests
* Use more $defined, remove "has_operator". Fix regression in `$defined(var $f = 123)`
---------
Co-authored-by: Christoffer Lerno <christoffer@aegik.com >
2025-08-25 14:47:08 +02:00
Christoffer Lerno
3e641ab82b
Properly add "inlined at" for generic instantiation errors #2382 .
2025-08-25 13:31:56 +02:00
Christoffer Lerno
7972397c65
Incorrect name on wincrt, likely a regression.
2025-08-24 13:54:52 +02:00
Christoffer Lerno
9bf933ae31
- has_tagof on tagged lambdas returns false #2432
2025-08-23 23:41:32 +02:00
Christoffer Lerno
961aa0ef61
Struct and typedef subtypes inherit dynamic functions.
2025-08-23 22:31:29 +02:00
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
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
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
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
7c8e3dd4fd
Fix max module name to 31 chars and the entire module path to 63 characters.
2025-08-18 12:02:00 +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
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
31b15c775e
Slicing a constant array with designated initialization would not update the indexes.
2025-08-14 20:27:23 +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
Christoffer Lerno
db99de9717
Improve codegen for stack allocated large non-zero arrays.
2025-08-12 17:01:39 +02:00
Christoffer Lerno
582453cb45
Assert triggered when trying to slice a struct.
2025-08-12 00:01:55 +02:00
Christoffer Lerno
be98a01ed8
types::has_equals fails with assert for bitstructs #2377
2025-08-11 20:53:11 +02:00
Christoffer Lerno
625a6d987d
Refactoring
2025-08-11 20:53:11 +02:00
sipekdan
0470f3be8e
Fix typo in bf16 suffix parsing logic
2025-08-11 19:20:19 +02:00
Christoffer Lerno
1d25197bfd
Bitstructs no longer overloadable with bitops. #2374
2025-08-06 14:51:37 +02:00
Christoffer Lerno
3b6d68ef21
Compiler segfault when using bitwise not on number literal cast to bitstruct #2373 .
2025-08-06 00:55:56 +02:00
Christoffer Lerno
24c03f9800
Fixed bug generating $c += 1 when $c was derived from a pointer but behind a cast.
2025-08-06 00:44:22 +02:00
Christoffer Lerno
abd3585c44
Parsing difference between "0x00." and "0X00." literals #2371
2025-08-05 13:09:53 +02:00
Christoffer Lerno
aa910a1c44
Compiler assert when using generic parameters list without any parameters. #2369
2025-08-05 12:50:36 +02:00
Christoffer Lerno
00b88a8027
Compiler assertion when defining a function with return type untyped_list #2368 . In general, improve error message when ct types are return types.
2025-08-05 04:11:54 +02:00
Christoffer Lerno
229fdd6193
Detect recursive creation of generics #2366 .
2025-08-05 02:55:32 +02:00
Christoffer Lerno
5292e08cd6
Remove lambda code that should never happen.
2025-08-04 22:13:37 +02:00
Christoffer Lerno
90990ed2f3
Support partial const enums despite use-old-enums enabled.
2025-08-04 17:06:17 +02:00
Christoffer Lerno
c99284103d
Fix issue with naked functions #2365
2025-08-04 15:51:49 +02:00
Christoffer Lerno
cb2d8133e0
Fixed: regression in comments for @deprecated and @pure.
2025-08-04 13:25:30 +02:00