Changes / improvements
- Added const enums:
enum Foo : const. Behaves like C enums but may be any type. - Casting to / from an enum is now possible again. No need to use
.ordinaland.from_ordinal. - Inline associated enum values are deprecated, use
--use-old-enumsto re-enable them. $typeofmay return a compile time type.- Improved error messages on missing qualifier on enum value. #2260
- Add
--echo-prefixto edit the prefix with$echostatements. Supports {FILE} and {LINE} - Catch accidental
foo == BAR;wherefoo = BAR;was most likely intended. #2274 - Improve error message when doing a rethrow in a function that doesn't return an optional.
- Add
--list-asmto view all supportedasminstructions. - Formatting option "%h" now supports pointers.
- Improve error on unsigned implicit conversion to signed.
- Update error message for struct initialization #2286
- Add SipHash family of keyed PRFs. #2287
$is_constis deprecated in favour of@is_constbased on$defined.- Multiline contract comments #2113
- Removed the use of temp allocator in backtrace printing.
env::AUTHORSandenv::AUTHOR_EMAILSadded.- Suppress codegen of panic printing with when panic messages are set to "off".
- Implicit linking of libc math when libc math functions are used.
- Allow even smaller memory limits.
- Check unaligned array access.
- Add "@structlike" for typedefs.
- "poison" the current function early when a declaration can't be correctly resolved.
- Add komihash, a5hash, metrohash64, metrohash128, and wyhash2 variants with tests/benchmark. #2293
- '$assignable' is deprecated.
- Deprecate allocator::heap() and allocator::temp()
- Add
thread::fenceproviding a thread fence. - Place output in
outby default for projects. Use temp folder for building at the command line. - Allow absolute paths for
$embed. - Add
@tryand@try_catch. - Assignment evaluation order now right->left, following C++17 and possibly C23.
Fixes
- mkdir/rmdir would not work properly with substring paths on non-windows platforms.
- Hex string formatter check incorrectly rejected slices.
- Correctly reject interface methods
typeandptr. - Comparing a null ZString with a non-null ZString would crash.
- Switch case with const non-int / enum would be treated as ints and crash. #2263
- Missing bounds check on upper bound with const ranges
foo[1:3]. - Check up the hierarchy when considering if an interface cast is valid #2267.
- Fix issue with labelled break inside of a $switch.
- Non-const macros may not return untyped lists.
$forct-state not properly popped.- Inline
r / complexfor complex numbers fixed. - Const slice lengths were not always detected as constant.
- Const slice indexing was not bounds checked.
- Initialize pool correctly in print_backtrace.
--max-memnow works correctly again.- Casting a fault to a pointer would trigger an assert.
- Make
to_floatmore tolerant to spaces. - Fixes to thread local pointer handling.
- Fixes to JSON parsing and Object.
- Array indices are now using int64 internally.
- Bit shift operation fails with inline uint enum despite matching underlying type #2279.
- Fix to codegen when using a bitstruct constant defined using a cast with an operator #2248.
- Function pointers are now compile time constants.
- Splat 8 arguments can sometimes cause incorrect behaviour in the compiler. #2283
- Correctly poison the analysis after a failed $assert or $error. #2284
$foovariables could be assigned non-compile time values.$foo[0] = ...was incorrectly requiring that the assigned values were compile time constants.- "Inlined at" would sometimes show the current location.
- Fixed bug splatting constants into constants.
- Resize bug when resizing memory down in ArenaAllocator, DynamicArenaAllocator, BackedArenaAllocator.
- Error message for missing arg incorrect for methods with zero args #2296.
- Fix stringify of $vaexpr #2301.
- Segfault when failing to cast subexpression to 'isz' in pointer subtraction #2305.
- Fix unexpected display of macro definition when passing a poisoned expression #2305.
@linkson macros would not be added to calling functions.- Fix
Formatter.printreturning incorrect size. - A distinct type based on an array would yield .len == 0
- Overloading addition with a pointer would not work.
- Copying const enums and regular enums incorrect #2313.
- Regression: Chaining an optional together with contracts could in some cases lose the optional.
char[*] b = *(char[*]*)&a;would crash the compiler ifawas a slice. #2320- Implicitly cast const int expressions would sometimes not be detected as compile time const.
- Using @NoReturn in a short body macro would not work properly #2326.
- Bug when reporting error in a macro return would crash the compiler #2326.
- Short body return expression would not have the correct span.
- Fix issue where recursively creating a dir would be incorrectly marked as a failure the first time.
@formatdid not work correctly with macros #2341.- Crash when parsing recursive type declaration #2345.
- Remove unnecessary "ret" in naked functions #2344.
- Lambdas now properly follow its attributes #2346.
- Not setting android-ndk resulted in a "set ndk-path" error.
- Lambda deduplication would be incorrect when generated at the global scope.
- Disallow accessing parameters in a naked function, as well as
return, this fixes #1955. - Assigning string literal to char[<*>] stores pointer rather than characters. #2357
Stdlib changes
- Improve contract for readline. #2280
- Added Whirlpool hash.
- Added Ed25519.
- Added string::bformat.
- Virtual memory library.
- New virtual emory arena allocator.
- Added
WString.len. - Added
@addrmacro. - Add
ConditionVariable.wait_untilandConditionVariable.wait_for - Added readline_to_stream that takes a stream.
- Added
RefandRefCountedexperimental functionality. - Added
Volatilegeneric type. - Added
UnalignedRefgeneric type. - Add String conversion functions snake_case -> PascalCase and vice versa.