TLDR
- Added the flintc and fip-c packages in the AUR
- Added the flintc and fip-c packages in the COPR repository
- Added Flint.Flintc, Flint.Fls and Flint.Fip-C packages to Winget
- Fixed Windows being entirely broken since
v0.3.2 - Added debug symbols etc to enable debugging of Flint programs using
gdb. All Flint types have proper debug type representations, code stepping & breakpoints now work too, so Flint now can fully be debugged.lldbworks too for debugging, but many types are incorrectly displayed in it (caused by it's incapability of evaluating debug expressions at debug-time, for whatever reason) - Added proper hover information to the LSP when hovering over variables and types, added ability to jump to definitions / declarations of variables, added ability to jump to imported files
- Added ability to define named opaque types:
use Core.print
opaque NamedOpaque;
extern def create_named_opaque() -> NamedOpaque;
extern def free_named_opaque(mut NamedOpaque* value);
def main():
print("Hello, World!\n");
NamedOpaque o = create_named_opaque();
print($"Created new named opaque {o}\n");
free_named_opaque(&o);#include <stdio.h>
#include <stdlib.h>
typedef void *NamedOpaque;
NamedOpaque create_named_opaque() {
printf("Creating new named opaque\n");
NamedOpaque no = (NamedOpaque)malloc(8);
*(size_t *)no = (size_t)100;
return no;
}
void free_named_opaque(NamedOpaque *value) {
printf("Freeing named opaque %p\n", *value);
free(*value);
*value = NULL;
}Hello, World! Creating new named opaque Created new named opaque 0x2f5440b0 Freeing named opaque 0x2f5440b0
- Implemented "const array types", arrays with compile-time known sizes:
use Core.print
def main():
i32[3] v3 = i32[3](0);
v3.[0, 1, 2] = (10, 20, 30);
for (i, elem) in v3:
print($"v3[{i}] = {elem}\n");v3[0] = 10 v3[1] = 20 v3[2] = 30
- Added support for inline-initialized arrays:
- Added ability to infer the sizes of inline-initialized arrays using the default operator / expression
_:
use Core.print
def main():
i32[] arr = i32[_]{10, 20, 30, 40};
for (i, e) in arr:
print($"arr[{i}] = {e}\n");arr[0] = 10 arr[1] = 20 arr[2] = 30 arr[3] = 40
- Added a lot of new error types for proper compile error printing. A lot of
THROW_BASIC_ERRfunctions still need to be replaced with proper typedTHROW_ERRcalls, but we are slowly getting there... - Added ability to discard expression results using the default operator
_:
use Core.print
def get_strings() -> (str, str):
return ("Hi", "there");
def print_and_add(i32 x, i32 y) -> i32:
print($"adding {x} and {y}\n");
return x + y;
def main():
(_, y) := get_strings();
print($"y is \"{y}\"\n");
_ = print_and_add(30, 40);y is "there" adding 30 and 40
- Implemented ability to access data coming from parent entities within free-floating entity functions
use Core.print
data Data1:
i32 x;
i32 y;
Data1(x, y);
data Data2:
i32 z;
i32 w;
Data2(z, w);
func Func requires(Data1 d):
def fun():
print("fun\n");
entity E:
data: Data1 d1;
func: Func;
E(d1)
entity Entity extends(E e1):
data: Data2 d2;
Entity(e1, d2);
def print():
print($"d1.(x, y) = {e1.d1.(x, y)}, d2.(z, w) = {d2.(z, w)}\n");
def main():
e := Entity(Data1(10, 20), Data2(30, 40));
e.print();d1.(x, y) = (10, 20), d2.(z, w) = (30, 40)
- Added ability to alias Core module imports (it was already working, but prevented by old explicit checks lol)
use Core.print as p
data Data1:
i32 x;
i32 y;
Data1(x, y);
entity Entity:
data: Data1 d1;
Entity(d1);
def print():
p.print($"d1.(x, y) = {d1.(x, y)}\n");
def main():
e := Entity(Data1(10, 20));
e.print();d1.(x, y) = (10, 20)
Changelog
- Fixed Windows being entirely broken since
v0.3.2(Windows is a lot more sensible to these little mistakes than Linux is):- Fixed incorrect global variable name in
timeCore module on Windows (commit) - Fixed atomic store not working on optional wrapped pointer for the main function storage (commit)
- Fixed DIMA head type duplication of types from Core modules (commit)
- Fixed global eum string value cration duplication similar to recent DIMA head type duplication (commit)
- Fixed a few incorrect signatures of C functions (commit)
- Removed tail calling convention for Windows, it seems to dislike it pretty hard (commit)
- Fixed enum value string deduplication code, had some logic errors (commit)
- Fixed mistake where the
SetConsoleOutputCPfunction to set console output to UTF-8 was never called in the test runner in Windows (commit) - Fixed bug in
generate_visible_width_functionwhere an i32 value was stored in the i64 allocation for the visible line width, leading in extremely large line widths -> garbage (commit) - Updated arrays wiki tests regarding CLI args to properly work on Windows (commit)
- Fixed similar bug with potential garbage in
generate_f64_to_strfunction like the previousgenerate_visible_width_functionfix (commit) - Fixed uninitialized memory bug in
generate_init_heads_function(commit) - Fixed
2_unwrap_err.fttest expecting the wrong exit code on Windows (commit) - Fixed off-by-one error in persistent frame freeing and cloning code (commit)
- Fixed
parseCore module not working on Windows becauseerrnois not a global variable on Windows. You need to call_errnoto get the value, you can't use the global variable directly (commit) - Fixed system Core module not working on Windows because
stdoutandstderrare not available as global variables. You need to callacrt_iobto getstdout/stderron Windows (commit) - Fixed
parseCore module through usingstrtoll/strtoullinstead ofstrtol/strtoulfor 64-bit integer parsing (commit) - Fixed AOC Day 2 on Windows (commit)
- Fixed small logic bug in AOC day 4 which went unnoticed in Linux but leads to incorrect output on Windows (commit)
- Fixed
get_absolutefunction for absolute Windows paths (commit) - Added
remove_with_retryfunction. This function is needed because removing the.objfile immediately after compiling crashes the compiler on Windows (invalid access exception) (commit)
- Fixed incorrect global variable name in
- Added a lot of new error types:
- Added missing THROW_ERR calls for already present error types (commit)
- Added the
ErrDefFuncRequiredTypeNotDataandErrDefFuncRequiredTypeUnknownerror types (commit) - Added the
ErrDefEntityExtendedTypeNotEntityandErrDefEntityExtendedTypeUnknownerror types (commit) - Fixed incorrect types in constructors of newly added error types (commit)
- Added
ErrDefEntityNoDataerror type (commit) - Added the
ErrFnDefMissingerror type (commit) - Added
ErrDefEntityDuplicateParenterror type (commit) - Added
ErrDefEntityDuplicateParentAccessorerror type (commit) - Changed diagnostic output of
ErrParsUnexpectedToken, it used a comma as a delimiter between tokens, but it looks very weird if one of the expected tokens is a comma too, it now uses spaces as token delimiters (commit) - Added
ErrDefEntityDuplicateDataAccessorerror type (commit) - Unified the
ErrDefEntityDuplicateDataAccessorandErrDefEnttiyDuplicateParentAccessorinto a newErrDefEntityDuplicateAccessorerror type (commit) - Added
ErrDefEntityMissingConstructorerror type (commit) - Added
ErrDefEntityProvidedTypeNotDataerror type (commit) - Fixed mistake where colors were used in the
to_diagnosticfunction of theErrDefEntityUnresolvedVirtualerror type (commit) - Added
ErrDefEntityProvidedTypeNotFuncerror type (commit) - Added error handling instead of assertions in a few places (commit)
- Added
ErrDefEnttiyDuplicateAccessorInConstructorerror type (commit) - Renamed entity constructor error types (commit)
- Added
ErrDefEntityConstructorNotDataerror type (commit) - Added
ErrDefEntityConstructorDataWitoutAccessorerror type (commit) - Added
ErrDefEntityConstructorDataNotPresenterror type (commit) - Added
ErrDefEntityConstructorDuplicateDataerror type (commit) - Renamed
ErrDefFunctionRedefinitiontoErrFnRedefinition, fixed path printing of error (commit) - Added
ErrDefEntityFnRedefinitionerror type (commit) - Added
ErrDefEntityNoFunctionalityerror type (commit) - Renamed a few import-related error types to be more consistent, removed unused error types (commit)
- Added
cwd_relativeinline helper function to theBaseErrorclass (commit) - Added
ErrImportDuplicateAliaserror type (commit) - Changed
BaseError::cwd_relativesignature to correctly resolve hashes from Core modules too (commit) - Added
ErrExprDataInitializerWrongArgCounterror type (commit) - Added
ErrExprDataInitializerMissingDefaultValueerror type (commit) - Genralized the
ErrExprDataInitializerWrongArgCounterror type to theErrExprInitializerWrongArgCounterror type - Implemented proper error handling for type mismatches in entity initializers (commit)
- Added
ErrExprCastInvaliderror type (commit) - Added
ErrExprCastMultiLengthMismatcherror type (commit) - Added
ErrExprCallOnWrongInstanceTypeerror type (commit) - Added
ErrExprCallAmbiguouserror type (commit) - Removed edge-case handling and
THROW_BASIC_ERRcases increate_call_or_initializer_basefunction which were actually unreachable, changed them to assertions instead (commit) - Added
ErrExprUnaryOpMissingExprerror type (commit) - Added
ErrExprFieldNonexistenterror type (commit) - Added
ErrExprFieldAccessOnEntityerror type (commit) - Added
ErrExprFieldAccessNotAllowedOnTypeerror type (commit) - Refactored the
ErrExprFieldNonexistenterror to preserve field ordering and properly added field-checking for multi-types (commit) - Added
ErrExprEnumTagNotPresenterror type (commit) - Implemented some error cases, removed some redundant
THROW_BASIC_ERRcalls (commit) - Added
ErrExprArrayAccessNotAllowedOnTypeerror type (commit) - Added
ErrAnnotDuplicateerror type (commit) - Added
ErrAnnoUnknownerror type (commit) - Added
ErrAnnoLeftovererror type (commit) - Added
ErrEmptyStoredFixedArrayerror type (commit)
- Implemented parsing of "const array types", array types whose sizes are compile-time known (commit)
- Implemented codegen of arrays with comptime-known sizes (commit)
- Added missing primitive types (
u16,i8,i16) toFIP::convert_typefunction (commit) - Updated FIP, implemented the new
FIP_TYPE_ARRAYcapability (commit) - Moved all lambda "process functions" of the
parse_all_open_XYZfunctions to their own functions, it's just cleaner that way (commit) - Added checks for unexpected token and unexpected type error cases (commit)
- Implemented ability to access data coming from parent entities within free-floating entity functions (commit)
- Added ability to alias Core module imports (it was already working, but prevented by old explicit checks lol) (commit)
- Removed unreachable code. Fip imports resolve to real file imports (commit)
- Simplified unnecessarily complex code to get the function name since it's impossible for a function call to not have a name (it would not have been matched as a function call at all in this theorethical case) (commit)
- Added
get_signature_stringfunction toFunctionNode, this reduces code duplication regarding the printing of functions by a lot (commit) - Added
assert.hppfile which contains anASSERTandUNREACHABLEmacro (commit) - Removed all occurrences of
assert, changed them to the newASSERTmacro which will be present in both debug and release builds (commit) - Removed all
assert(false)calls, changed them toUNREACHABLE()instead (commit) - Added yaml files for winget,
flintcandflsneeded to be separate (commit) - Aded Nix and Fedora package files (
.nixand.spec) (commit) - Added
parse_programfunction to the parser to clean up the main file a bit (commit) - Removed the
--print-fip-versionflag since--versionprints the FIP version already (commit) - Restructured and cleaned up
mainfunction, removedgenerate_programfunction from the file (commit) - Renamed CLP field
build_exetooutput_ll_filesince that's more clear what it does, removedwrite_ll_filefunction (commit) - Moved
compile_programfunction from main file to the generator where it belongs (commit) - Removed passing of the
stackptr as a register when in debug mode (commit) - Set codegen optlevel to none when in debug mode (commit)
- Moved newline printing before the hard crash check, as the assertion would be printed in the same line as the file info otherwise (commit)
- Added FIP version printing to the
flsbinary (commit) - Added the
Generator::Debugsubclass to provide debug symbols, debug types and the ability to debug Flint programs in general (commit) - Added ability to pass in the LLVM directory as a flag to the build script (for building with / for Nix) (commit)
- Added ability to pass in the
fipandjson-minidependency directories to the build script, alongside thegit_hashand thengitis no longer needed to build the compiler (for Nix builds) (commit) - Added "pos triple" to the initializer of expression nodes so that the fields
line,columnandlengthare always properly initialized for all expressions (commit) - Updated
StatementNodeinitializers to make sure thefile_hash,line,columnandlengthfields of statements are always properly initialized (commit) - Added parameter to
get_signature_stringfunction of theFunctionNodeto get get the function as a function reference when requested (commit) - Added
file_hash,lineandcolumnfields to the scope variables to provide a way to "trace back" where a variable came from (commit) - Added the
end_linefield to the baseASTNodeand set it when creating scoped statements or definitions (commit) - Added hover information and GOTO definition support to the FLS (commit)
- Added ability to define named opaque types (commit)
- Implemented named opaque types, updated FIP hash (commit)
- Added support for inline-initialized arrays (commit)
- Added ability to infer the sizes of inline-initialized arrays using default-expressions, fixed
array_initializerpattern (commit) - Added missing newline to opaque help printing (commit)
- Unified
is_producercheck directly as a new function in theExpressionNodeto reduce code-duplication and fragility (commit) - Added ability to discard expression results using the default operator
_(commit) - Refactored the
utils.fttest runner to test compilation with different flags on all wiki tests. This helps to find bugs related to various compiler flags (bugs specific to the--parallelor-O fastflags for example) (commit) - Added emission of debug information for function parameters (commit)
- Moved
file_exists_and_is_readableandload_filefunctions from theParserto theio.hppfile, created a newIOclass to properly namespace the functions (commit) - Removed the
-f/--fileflags and moved to a position-independent file flag instead, added-Tflag in addition to--target, changed--output-ll-fileflag to--emit-ir(commit) - Removed
--fileflag requirements from all files and test files (commit) - Removed
/usr/lib/libc.afile frompossible_musl_paths, it prevented proper error messages to be printed when musl is not installed (commit) - Added compilation using the
--staticflag to thecompile_vfunction ofutils.ft(commit) - Changed
overflow_modeandoob_modefields to justmodeinstead, addedoptimize_modefield to themetadata.jsonto rebuild Core libraries when the optimize mode changes (commit) - Removed remains of the old "depth-1" LSP optimizations which now led to LSP crashes on larger multi-file projects (commit)
- Added ability to use the reference operator
&on arrays and added (missing) ability that any pointer type can be cast to any opaque type implicitely (commit) - Fixed bug where extending multiple entities would crash the compiler (commit)
- Added wiki tests for named opaque types (commit)
- Moved
--no-fipflag from debug options to release options, now every version of the compiler has this flag (commit) - Cleaned up type analyzation, removed analyzation duplication from function definitions, statements and expressions. This also revealed a bug where the analyzer was actually run before parsing functions, which is wrong (commit)
- Fixed bug where a dual EDG mapping would lead to an error, but this case is well-defined (commit)
- Fixed incorrect parsing of entity constructors when extending multiple entities (commit)
- Fixed bug where expressions like
not trueornot falsewould crash the parser (commit) - Fixed grouped enum values not working correctly, i missed that because assertions are disabled in release builds... (commit)
- Fixed double-free bug for grouped data accesses (commit)
- Fixed unnecessary allocation where scratchspace should have been used (commit)
- Fixed bug where the wrong entity type was expected for initializer x if the initialization order and definition order of data of an entity differ (commit)
- Fixed incorrect ll file outputting flag bug introduced in 0504f65 (commit)
- Fixed mistake where the parser would hard-crash if an expression in a string interpolation is not castable to a string (commit)
- Fixed mistake where base
ASTNodefields were uninitialized forCatchNodes (commit) - Fixed mistake where base
ASTNodefields were uninitialized for several statement nodes (commit) - Fixed bug in string interpolation creation where the length of the expression was garbage because the token at
expr_tokens.end()was dereferenced and that token is uninitialized as it extends beyond the list. The lexer now properly inserts anEOFtoken for string interpolation content of size 1 (commit) - Fixed bug where transitive import optimization of the LSP led to incorrect error diagnostics (commit)
- Fixed bug where the index and iterable in enhanced for loop and the iterable definition in the for loop were not collected in the
get_all_variablesfunction (commit) - Fixed bug where an llvm assertion was thrown because one
DIBuildercan have atmost oneDICompileUnitcreated from it (commit) - Fixed bug where else scope was a nullpointer because the if node was constructed before the
end_linecalculation (commit) - Fixed bug where debug allocations of enhanced for loops were tried to be accessed before they were created (commit)
- Fixed bug where the compiler would crash because no
DIFileexists for Core modules (commit) - Fixed bug where the expression being implicitely cast to an optional was not cast to the base cast first. This prevented
i32[10]to be cast toi32[]?even thoughi32[10]is castable toi32[](commit) - Fixed bug where recursive self-referential types (like data or callables) led to infinite recursion in the debug type creation (commit)
- Fixed bug where opaque types were handled as references even though they are simple values passed around, like any other primitive value (commit)
- Fixed #10, updated FIP version hash (commit)
- Fixed functions and tests crashing when building in release mode as the
DIBuilderis anullptrin release mode (commit) - Fixed bug which led to variant extractions to be matched as array initializers (commit)
- Fixed bug where all opaque types resolved to
void*when resolving symbols in FIP instead of opaque types when they are named (commit) - Fixed bug where the null coalescing operator would return a reference to it's inner value instead of a clone of it leading to double-free errors (commit)
- Fixed bug where string additions of string interpolations would lead to double-free errors because they would be marked as garbage twice (commit)
- Fixed bug where compiling in release mode would crash the compiler because debug info tried to be emitted unconditionally (commit)
- Fixed FIP not working with the
--parallelthread since multiple threads tried to init FIP at once or send / recieve messages from the IMs. The FIP is inherently single-threaded (commit) - Fixed use-after free bug when returning a local variable from within a nested scope (commit)
- Fixed bug where discarded calls would lead to the codegen phase crashing (commit)
- Fixed entity dispatch function not working in release mode because of incorrect calling convention (missing tailcc on linux in release mode) (commit)
- Fixed bug where concurrent line collapsing led to race condition when parsing all open entities in parallel (commit)
- Fixed bug where a single
datakeyword without a following type group<...>was matched as a type, leading to crashes in the collapse type phase of entities (commit) - Fixed bug where the now resolved entity type was unexpected at the entity constructor line (it expected an initializer but now through the collapsing of the types it got a type) (commit)
- Fixed bug where
errnowas not available inmusl, which now means that the__errno_locationfunction is called in both glibc and musl instead, similar to the_errnofunction on Windows (commit) - Fixed bug where
sretallocations for extern calls were not generated in theGenerator::Allocation::generate_call_allocationsfunction (commit) - Fixed bug where wrong overload of llvm function to add parameter attributes was called leading to a thrown assertion (commit)
- Fixed race condition where multiple threads mutated the per-instance
last_parsed_callmember of the parser, made the variable static but alsothread_localto resolve this issue (commit) - Fixed bug where
byvalfunction attribute was not added to extern functions returningvoid(commit) - Fixed bug where captured entity identifiers were not passed down to child scopes in their creation (commit)
- Fixed bug where the value and location pointers are swapped in an
IR::aligned_storecall in thegenerate_instance_callfunction leading to segmentation faults. Also the ordering was wrong, as thets_ptrfield is overwritten in the dispatch function in setup mode (commit) - Fixed bugs where putting a
constin front of adefin entities or func modules did not properly change the mutability of the implicit parameters like it should have done (commit) - Fixed mistake where method calls were not allowed on const instances of func or entity types, but method calls are allowed on const instances if the called method is marked as const too (commit)
- Fixed mistake where the types coming from aliased imported files could not be resolved in data and variant definitions (commit)
- Fixed bug in
resolve_alias_in_typefunction which consumed tokens but did not initialize theresult.resolved_typein all code paths resulting in nullpointer crashes down the line elsewhere (commit) - Fixed bug where a call as the switcher expression would lead to the switch statement being interpreted as a call statement instead (commit)
- Fixed bug where
breakstatements only targetted the last loop blocks and not any switch blocks too, as you still can (and should be able to use) the break statement in switch branches too (for example to break out of the branch early) (commit)
Full Changelog: v0.3.5-core...v0.4.0-core