Skip to content

Core 0.3.0

Choose a tag to compare

@zweiler1 zweiler1 released this 31 Dec 23:36
· 900 commits to main since this release
d458d17

Changelog

  • Migrated the whole build system from the old CMake + shell based build system to a Zig based build system. The whole Flint compiler now is able to be compiled from within Windows as well, making Windows now a "proper" target of the whole compiler, as a lot of windows-specific bugs were fixed too and everything now works on Windows as well as it does on Linux. Windows passes all the builtin regression tests with no failures. This means that Windows will be a first-class target from now onwards and it should always work exactly the same as the Linux version of the flintc compiler.
  • Added support for type aliasing (commit):
use Core.print

type SomeTuple data<i32, f32, u64>

def add(mut SomeTuple st):
	st.($0, $1, $2) += (4, 2.2, 7);

def main():
	SomeTuple st = (-10, 2.3, 2);
	add(st);
	print($"st.($0, $1, $2) = ({st.$0}, {st.$1}, {st.$2})\n");
use Core.print

def main():
    i32 num = 0;
    do:
        print($"num = {num}\n");
        num++;
    while num < 5;
  • Added support for annotations and implemented the first annotation, #test_should_fail (commit):
use Core.print
use Core.assert

#test_should_fail
test "should fail":
	assert(false);

def main():
	print("Compile with --test to create a test binary!\n");
  • Added the time Core module (commit, merge) to provide:
    • functions: now, duration, as_unit, sleep and from
    • enum types: TimeUnit
    • data types: TimeStamp, Duration
  • Added the #test_performance annotation to profile how long a test takes to run utilizing the new time module (commit)
  • Added the get_cwd (commit) and get_path (commit) functions to the system Core module
  • Added internal mappings of error types and values to strings to enable casting of errors to strings. Greatly improved the output when an error bubbles up to the main function as well (commit)
use Core.print
use Core.assert

#test_should_fail
test "should fail":
	assert(false);

def main():
	print("Compile with --test to create a test binary!\n");
ErrFn:
 - type_id: 1912322386
 - value_id: 0
 - message: Special Assertion in 'myfn' function failed

error is ErrFn.AssertionFailed: "Special Assertion in 'myfn' function failed"

The given error bubbled up to the main function:
 └─ ErrFn.AssertionFailed: "Special Assertion in 'myfn' function failed"
  • Added support for using ranges as iterables in enhanced for loops (commit):
use Core.print

def main():
	u64 start = 5;
	u64 end = 10;
	for (i, elem) in start..end:
		print($"{i}: {elem}\n");
  • Added array accessing support for arrays of tuples and multi-types (commit)
  • Added ability to access arrays of enums (commit)
  • Added support for stacked array assignments (arr[5][3] = 'B';) (commit, commit and commit)
  • Added support for stacked array accesses (val = arr[5][3];) (commit)
  • Added support for splatting (commit):
use Core.print

def main():
	i32x3 vec3 = (10, 20, 30);
	print($"vec3 = {vec3}\n");
	vec3 = vec3 * 2;
	vec3 *= i32(2);
	print($"vec3 = {vec3}\n");
  • Added syntax highlighting of Flint to GitHub via the .gitattributes file, Flint code is now displayed as TypeScript code on GitHub (commit)
  • Added regression tests for the examples in the examples directory (commit and commit)
  • Added short-circuit ability to the and and or boolean binary operators (commit)
  • Added the test_compiles and test_compiles_in functions to the utils.ft test runner file to only compile the example tests but not run them, since they are interactive applications (commit)
  • Added detection of the $"{expr}" string interpolation case, this is considered an error since you should use str(val) instead
    Fixed this very same problem in the fsh example (commit and commit)
  • Added the str? flags parameter to the test_compiles_in function to optionally take more arguments to make pong-2.0 compile, since the linker flags (-lraylib) were missing before. The example_tests.ft tests now fully work (commit)
  • Added printing of compilation performance for all example projects and compilation + runtime performance for all AOC tests (commit)
  • Added SetConsoleOutputCP call to enable UTF-8 formatting on Windows for built Flint programs (commit)
  • Added building of the Flint Language Server to the build.zig build system (commit)
  • Added test flag to the build.zig build system (commit)
  • Added the ErrExprInterpolationOnlyOneExpr error type for when an interpolation only contains a single expression and nothing else like $"{expr}", it informs the user to use str(expr) instead (commit)
  • Updated all wiki tests with the new #test_should_fail annotation to make all tests which should fail succeed (commit)
  • Updated all wiki Tests for the new error printing system (commit)
  • Changed the --run flag to shut up in release builds (commit)
  • Changed the tests target optional to build, it was slowing down development iteration speed since it was always built (commit)
  • Changed the IR names of all Core module's functions to start with <hash>. instead of __flint_, now all functions starting with __flint_ are "true" internal functions which can never be called by the user on his own (for example the typecast functions or arithmetic functions) (commit)
  • Moved the get_type_id_from_str function from Type to Hash to make every generated ID not only dependent from the type's name but also from which file it comes. This makes the whole ID system much more reliable, which is needed for the next features (commit)
  • Upgraded LLVM from 19.1.7 to 21.1.8 (commit)
  • Refactored the generate_debug_print function to be way more useful for actual debug runtime printing of built Flint programs (commit)
  • Completely overhauled the system_command Core module function to work on Windows (commit)
  • Updated the generate_get_arr_slice_function function to correctly mimic the new function from the prototypes (commit)
  • Updated all the wiki utils test functions to use the new get_path function to normalize paths before executing the compiler inside the paths, the import tests should now work on Windows (commit)
  • Completely overhauled the build.zig build file, it now builds a MUCH smaller LLVM installation and it is MUCH faster doing so (commit)
  • Removed all files of the old build system to move the transition to the Zig based build system forward (commit)
  • Removed the no longer needed scripts and tests directories, they were mostly unmaintained anyways (commit)
  • Changed the signature of the generate_string_addition function to return a potential nullopt since it can fail (commit)
  • Fixed memory leaks of variants holding strings (commit and commit)
  • Fixed enum to string casting parsing and codegen (commit)
  • Fixed bug where arrays of tuples were not properly detected as function parameter types (commit)
  • Fixed bug where assigning values to an array that holds elements which are > 8 bytes would fail entirely (commit)
  • Fixed bug where returning an array of tuples together with other return values was parsed incorrectly (commit)
  • Fixed incorrect formatting of the builtin test-runner, it now properly prints 1 test failed instead of 1 tests failed when only one test failed (commit)
  • Fixed mistake in the test_file_ok_in function in the utils.ft file which did not execute the built main inside the target cwd but only compiled it inside the target path (commit)
  • Fixed optional strings (str?) being broken (commit)
  • Fixed arguments of function calls not being auto-cast to match, for example if the argument is a string literal or string value for a function expecting an optional string (commit)
  • Fixed the problem of optional function parameters where values of the base type of the argument was passed in, all those arguments need temporary allocations since all optionals are passed by pointer to functions (commit)
  • Fixed bug where the last performance test also printed the vertical bar. If it's the last test it should not print it (commit)
  • Fixed the Windows build (commit)
  • Fixed bugs where the anyerror type was not castable to a string and the error fields were not accessible on it either (commit)
  • Fixed mistake of hashes being absolute-path based instead of relative-path based meaning they would differ on different systems or when the project is in a different location, but the only thing changing a hash of a file should be the actual "location" the file is at (in the given project) (commit)
  • Fixed the fetch_crt powershell script being broken (commit)
  • Fixed bug of time_init function being internally linked instead of external (commit)
  • Fixed the Zig build system to work on Windows (commit)
  • Fixed popen and pclose symbols not being available on Windows (commit)
  • Fixed mistake that printing the help via the --help or -h flags would exit with an exit code of 1 instead of 0 (commit)
  • Fixed mistake where branch preddictions were 100:0 (infinite) in the env core module generation code (commit)
  • Fixed bug where the same relative path resulted in a different hash on Windows (commit)
  • Fixed the set_env function on Windows through a wrapper function for the setenv function (commit)
  • Fixed incorrect static initialization order caused by LTO (commit
  • Fixed incorrect COMMIT_HASH macro in build.zig causing a malformed metadata.json file (commit)
  • Fixed FLS builds of the build.zig file (commit)
  • Fixed bug in the generate_read_lines_function where the return type of the function was ret.str instead of ret.str[], causing an assertion in llvm to fire when verifying the module (commit)
  • Fixed bug in the generate_enum_value_strings function which led to the same enum names being generated more than once, leading to linking errors (commit)
  • Fixed crash in the generate_types function of the time Core module whenever the time Core module is imported (commit)
  • Fixed bug where the test runner would always print an empty line at the top (commit)

Full Changelog: v0.2.5-core...v0.3.0-core