From cbacd6498781593e5ff60fb1eccdd3a34bca2f75 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Tue, 18 Feb 2025 18:53:30 +0100 Subject: [PATCH] Update tests to (Foo) { ... } syntax. --- lib/std/os/linux/linux.c3 | 2 +- src/compiler/parse_global.c | 2 +- src/compiler/sema_types.c | 7 +- test/test_suite/abi/darwin64_avx.c3t | 28 +- test/test_suite/abi/darwin64_avx512.c3t | 6 +- test/test_suite/abi/darwinx64_1.c3t | 11 +- test/test_suite/abi/literal_load.c3t | 4 +- test/test_suite/abi/literal_load_aarch64.c3t | 4 +- test/test_suite/abi/literal_load_mingw.c3t | 4 +- .../abi/riscv32-ilp32-ilp32f-ilp32d-abi-1.c3t | 6 +- .../abi/riscv32-ilp32-ilp32f-ilp32d-abi-2.c3t | 6 +- .../abi/riscv32-ilp32-ilp32f-ilp32d-abi-3.c3t | 6 +- test/test_suite/abi/riscv64-lp64-abi.c3t | 2 +- .../abi/riscv64-lp64-lp64f-lp64d-abi-1.c3t | 18 +- .../abi/riscv64-lp64-lp64f-lp64d-abi-2.c3t | 18 +- .../abi/riscv64-lp64-lp64f-lp64d-abi-3.c3t | 18 +- test/test_suite/abi/small_struct_x64.c3t | 4 +- test/test_suite/abi/sysv_direct_coerce.c3t | 2 +- test/test_suite/abi/vec2_aarch64.c3t | 12 +- test/test_suite/abi/vec2_wasm.c3t | 12 +- test/test_suite/abi/vec2_x64.c3t | 12 +- test/test_suite/arrays/array_bounds_check.c3t | 2 +- test/test_suite/arrays/inferred_subarray.c3 | 4 +- .../bitstruct/bitstruct_cast_const_init.c3t | 2 +- test/test_suite/bitstruct/bitstruct_ops.c3t | 4 +- .../designated_initializer_with_bitstruct.c3t | 8 +- .../builtins/reduce_arithmetics.c3t | 30 +- test/test_suite/builtins/sat_builtins.c3t | 2 +- test/test_suite/builtins/shufflevector.c3t | 10 +- test/test_suite/cast/cast_bitstruct_etc.c3t | 4 +- test/test_suite/cast/cast_ok.c3 | 2 +- test/test_suite/cast/cast_parse_fails.c3 | 2 +- test/test_suite/cast/cast_rcast.c3 | 2 +- .../compile_time_access_subscript.c3t | 12 +- .../compile_time/comptime_array_folding.c3t | 17 +- .../test_suite/compile_time/concat_append.c3t | 6 +- .../compile_time/concat_test_cases.c3 | 12 +- .../compile_time/ct_declaration_in_if.c3t | 2 +- test/test_suite/dynamic/dynamic_tracing.c3t | 2 +- test/test_suite/errors/error_regression_2.c3t | 10 +- test/test_suite/errors/optional_designated.c3 | 2 +- .../errors/optional_taddr_and_access.c3t | 4 +- .../generic/generic_lambda_complex.c3t | 4 +- test/test_suite/generic/used_without_param.c3 | 4 +- .../test_suite/generic/used_without_param2.c3 | 2 +- .../test_suite/generic/used_without_param3.c3 | 2 +- .../initialize/init_non_resolved_type.c3 | 2 +- .../initializer_lists/general_tests.c3t | 2 +- .../initializer_lists/infer_with_init.c3t | 6 +- .../initializer_lists/init_any_interface.c3 | 2 +- .../initializers_to_macros.c3 | 2 +- .../initializer_lists/subarrays.c3t | 6 +- test/test_suite/macros/hash_initializer.c3t | 2 +- .../method_ref_for_extension_method.c3 | 2 +- test/test_suite/pointers/const_ref.c3t | 4 +- .../slices/slice_to_slice_assign.c3t | 4 +- .../slices/slice_to_slice_vector_assign.c3t | 4 +- .../slices/various_const_slicing.c3t | 6 +- .../statements/custom_foreach_with_ref.c3t | 4 +- test/test_suite/stdlib/map_linux.c3t | 6 +- test/test_suite/stdlib/map_macos.c3t | 6 +- test/test_suite/stdlib/priorityqueue.c3t | 6 +- .../struct/init_cont_struct_array_locally.c3t | 4 +- .../struct/nested_struct_union_init.c3t | 26 +- test/test_suite/struct/struct_reinit.c3t | 2 +- .../switch/switch_in_defer_macro.c3t | 8 +- test/test_suite/types/enum_parse_errors.c3 | 2 +- test/test_suite/vector/gather_scatter.c3t | 12 +- test/test_suite/vector/vector_consts.c3t | 2 +- test/test_suite/vector/vector_from_i1.c3t | 2 +- .../vector/vector_to_array_cast.c3t | 4 +- test/unit/regression/bitstruct_ops.c3 | 4 +- test/unit/regression/bitstruct_ops2.c3 | 6 +- test/unit/regression/bitstruct_ops3.c3 | 2 +- test/unit/regression/cast_slice_to_arr.c3 | 2 +- test/unit/regression/ct_slice.c3 | 12 +- test/unit/regression/faults.c3 | 2 +- test/unit/regression/gather_scatter.c3 | 12 +- test/unit/regression/masked_load_store.c3 | 8 +- test/unit/regression/slice_assign.c3 | 2 +- test/unit/regression/swizzle.c3 | 4 +- test/unit/regression/vecpointer.c3 | 4 +- test/unit/regression/vector_conversion.c3 | 14 +- test/unit/regression/vector_ops.c3 | 6 +- test/unit/stdlib/collections/bitset.c3 | 4 +- test/unit/stdlib/collections/elastic_array.c3 | 34 +- test/unit/stdlib/collections/list.c3 | 34 +- test/unit/stdlib/core/array.c3 | 6 +- test/unit/stdlib/core/builtintests.c3 | 20 +- test/unit/stdlib/core/formatter.c3 | 2 +- test/unit/stdlib/encoding/csv.c3 | 4 +- test/unit/stdlib/io/multiwriter.c3 | 2 +- test/unit/stdlib/io/teereader.c3 | 2 +- test/unit/stdlib/math/math.c3 | 18 +- test/unit/stdlib/math/math_complex.c3 | 18 +- test/unit/stdlib/math/matrix.c3 | 6 +- test/unit/stdlib/math/quaternion.c3 | 4 +- test/unit/stdlib/net/url_encoding.c3 | 307 ++++++------------ 98 files changed, 449 insertions(+), 551 deletions(-) diff --git a/lib/std/os/linux/linux.c3 b/lib/std/os/linux/linux.c3 index 25e76f9ce..305db433e 100644 --- a/lib/std/os/linux/linux.c3 +++ b/lib/std/os/linux/linux.c3 @@ -95,7 +95,7 @@ fn ulong! elf_module_image_base(String path) @local defer (void)file.close(); char[4] buffer; io::read_all(&file, &buffer)!; - if (buffer != char[4]{ 0x7f, 'E', 'L', 'F'}) return BacktraceFault.IMAGE_NOT_FOUND?; + if (buffer != { 0x7f, 'E', 'L', 'F'}) return BacktraceFault.IMAGE_NOT_FOUND?; bool is_64 = file.read_byte()! == 2; bool is_little_endian = file.read_byte()! == 1; // Actually, not supported. diff --git a/src/compiler/parse_global.c b/src/compiler/parse_global.c index 84d9a4bdb..56cb2483d 100644 --- a/src/compiler/parse_global.c +++ b/src/compiler/parse_global.c @@ -1843,7 +1843,7 @@ static inline Decl *parse_interface_declaration(ParseContext *c) { do { - ASSIGN_TYPE_OR_RET(TypeInfo *type, parse_type(c), poisoned_decl); + ASSIGN_TYPE_OR_RET(TypeInfo *type, parse_optional_type_no_generic(c), poisoned_decl); vec_add(parents, type); } while (try_consume(c, TOKEN_COMMA)); } diff --git a/src/compiler/sema_types.c b/src/compiler/sema_types.c index f6fc21a98..360d9a0b0 100644 --- a/src/compiler/sema_types.c +++ b/src/compiler/sema_types.c @@ -394,9 +394,12 @@ INLINE bool sema_resolve_generic_type(SemaContext *context, TypeInfo *type_info) { RETURN_SEMA_ERROR(inner, "Parameterization required a concrete type name here."); } - if (inner->resolve_status != RESOLVE_NOT_DONE) + if (inner->resolve_status == RESOLVE_DONE) { - puts("feokf"); + if (!type_is_user_defined(inner->type)) + { + RETURN_SEMA_ERROR(inner, "A user defined type was expected here, not %s.", type_quoted_error_string(inner->type)); + } } ASSERT_SPAN(inner, inner->resolve_status == RESOLVE_NOT_DONE); diff --git a/test/test_suite/abi/darwin64_avx.c3t b/test/test_suite/abi/darwin64_avx.c3t index 0cd81ee08..66f0e7d09 100644 --- a/test/test_suite/abi/darwin64_avx.c3t +++ b/test/test_suite/abi/darwin64_avx.c3t @@ -3,8 +3,9 @@ module test; def Mm256 = float[<8>]; -struct St256 { - Mm256 m; +struct St256 +{ + Mm256 m; } St256 x38; @@ -20,18 +21,21 @@ fn void f39() { f38(x38); f37(x37); } // CHECK: declare void @func40(%struct.t128* byval(%struct.t128) align 16) def Mm128 = float[<4>]; -struct Two128 { - Mm128 m; - Mm128 n; +struct Two128 +{ + Mm128 m; + Mm128 n; } extern fn void func40(Two128 s); -fn void func41(Two128 s) { - func40(s); +fn void func41(Two128 s) +{ + func40(s); } -struct Atwo128 { - Mm128[2] array; +struct Atwo128 +{ + Mm128[2] array; } struct Sa { @@ -59,14 +63,14 @@ struct Complex { double i; double c; } extern fn void test52_helper(int, ...); Mm256 x52; fn void test52() { - test52_helper(0, x52, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, Complex { 0, 1.0 }); + test52_helper(0, x52, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, (Complex) { 0, 1.0 }); } extern fn void test54_helper(Mm256, ...); Mm256 x54; fn void test54() { - test54_helper(x54, x54, 1.0, 1.0, 1.0, 1.0, 1.0, Complex { 0, 1.0 }); - test54_helper(x54, x54, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, Complex { 0, 1.0 }); + test54_helper(x54, x54, 1.0, 1.0, 1.0, 1.0, 1.0, (Complex) { 0, 1.0 }); + test54_helper(x54, x54, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, (Complex) { 0, 1.0 }); } def Mm512 = float[<16>]; diff --git a/test/test_suite/abi/darwin64_avx512.c3t b/test/test_suite/abi/darwin64_avx512.c3t index b4ffedd01..367c4bbd9 100644 --- a/test/test_suite/abi/darwin64_avx512.c3t +++ b/test/test_suite/abi/darwin64_avx512.c3t @@ -45,14 +45,14 @@ struct Complex { double i; double c; } extern fn void f62_helper(int, ...); Mm512 x62; fn void f62() { - f62_helper(0, x62, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, Complex { 1.0, 1.0 }); + f62_helper(0, x62, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, (Complex) { 1.0, 1.0 }); } extern fn void f64_helper(Mm512, ...); Mm512 x64; fn void f64() { - f64_helper(x64, x64, 1.0, 1.0, 1.0, 1.0, 1.0, Complex { 1.0, 1.0 }); - f64_helper(x64, x64, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, Complex { 1.0, 1.0 }); + f64_helper(x64, x64, 1.0, 1.0, 1.0, 1.0, 1.0, (Complex) { 1.0, 1.0 }); + f64_helper(x64, x64, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, (Complex) { 1.0, 1.0 }); } diff --git a/test/test_suite/abi/darwinx64_1.c3t b/test/test_suite/abi/darwinx64_1.c3t index 22f815b5b..7b75cffed 100644 --- a/test/test_suite/abi/darwinx64_1.c3t +++ b/test/test_suite/abi/darwinx64_1.c3t @@ -1,15 +1,18 @@ // #target: macos-x64 module test; -fn char f0() { +fn char f0() +{ return 0; } -fn short f1() { +fn short f1() +{ return 0; } -fn int f2() { +fn int f2() +{ return 0; } @@ -32,7 +35,7 @@ struct Struct8 int b; } -fn Struct8 f8_1() { while (0) {} return Struct8 {}; } +fn Struct8 f8_1() { while (0) {} return (Struct8) {}; } fn void f8_2(Struct8 a0) {} /* #expect: test.ll diff --git a/test/test_suite/abi/literal_load.c3t b/test/test_suite/abi/literal_load.c3t index ceea530eb..66a71f63b 100644 --- a/test/test_suite/abi/literal_load.c3t +++ b/test/test_suite/abi/literal_load.c3t @@ -11,8 +11,8 @@ extern fn void blorg(Test t); fn Test creator() { - blorg(Test{}); - return Test{}; + blorg((Test){}); + return (Test){}; } /* #expect: literal_load.ll diff --git a/test/test_suite/abi/literal_load_aarch64.c3t b/test/test_suite/abi/literal_load_aarch64.c3t index 67328d899..d2ca84e40 100644 --- a/test/test_suite/abi/literal_load_aarch64.c3t +++ b/test/test_suite/abi/literal_load_aarch64.c3t @@ -12,8 +12,8 @@ extern fn void blorg(Test t); fn Test creator() { - blorg(Test{}); - return Test{}; + blorg((Test){}); + return (Test){}; } /* #expect: literal_load.ll diff --git a/test/test_suite/abi/literal_load_mingw.c3t b/test/test_suite/abi/literal_load_mingw.c3t index 656d6ecd8..291540b49 100644 --- a/test/test_suite/abi/literal_load_mingw.c3t +++ b/test/test_suite/abi/literal_load_mingw.c3t @@ -12,8 +12,8 @@ extern fn void blorg(Test t); fn Test creator() { - blorg(Test{}); - return Test{}; + blorg((Test){}); + return (Test){}; } /* #expect: literal_load.ll diff --git a/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-1.c3t b/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-1.c3t index 23bf49834..6bdf8968d 100644 --- a/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-1.c3t +++ b/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-1.c3t @@ -171,9 +171,9 @@ fn void f_agg_stack(double a, long b, double c, long d, Tiny e, extern fn int f_va_callee(int, ...); fn void f_va_caller() { - f_va_callee(1, 2, 3, 4.0, 5.0, Tiny{6, 7, 8, 9}, - Small{10, null}, Small_aligned{11}, - Large{12, 13, 14, 15}); + f_va_callee(1, 2, 3, 4.0, 5.0, (Tiny){6, 7, 8, 9}, + (Small){10, null}, (Small_aligned){11}, + (Large){12, 13, 14, 15}); } diff --git a/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-2.c3t b/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-2.c3t index 5a5533c28..bfec66560 100644 --- a/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-2.c3t +++ b/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-2.c3t @@ -172,9 +172,9 @@ fn void f_agg_stack(double a, long b, double c, long d, Tiny e, extern fn int f_va_callee(int, ...); fn void f_va_caller() { - f_va_callee(1, 2, 3, 4.0, 5.0, Tiny{6, 7, 8, 9}, - Small{10, null}, Small_aligned{11}, - Large{12, 13, 14, 15}); + f_va_callee(1, 2, 3, 4.0, 5.0, (Tiny){6, 7, 8, 9}, + (Small){10, null}, (Small_aligned){11}, + (Large){12, 13, 14, 15}); } diff --git a/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-3.c3t b/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-3.c3t index dd1473048..8bb9b31a8 100644 --- a/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-3.c3t +++ b/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-3.c3t @@ -172,9 +172,9 @@ fn void f_agg_stack(double a, long b, double c, long d, Tiny e, extern fn int f_va_callee(int, ...); fn void f_va_caller() { - f_va_callee(1, 2, 3, 4.0, 5.0, Tiny{6, 7, 8, 9}, - Small{10, null}, Small_aligned{11}, - Large{12, 13, 14, 15}); + f_va_callee(1, 2, 3, 4.0, 5.0, (Tiny){6, 7, 8, 9}, + (Small){10, null}, (Small_aligned){11}, + (Large){12, 13, 14, 15}); } diff --git a/test/test_suite/abi/riscv64-lp64-abi.c3t b/test/test_suite/abi/riscv64-lp64-abi.c3t index cac4953fe..32afce841 100644 --- a/test/test_suite/abi/riscv64-lp64-abi.c3t +++ b/test/test_suite/abi/riscv64-lp64-abi.c3t @@ -14,7 +14,7 @@ fn int f_scalar_stack_1(int a, int128 b, float c, float128 d, V32i8 e, fn Large f_scalar_stack_2(double a, int128 b, float128 c, V32i8 d, char e, ichar f, char g) { - return Large {(long)(a), e, f, g}; + return (Large) {(long)(a), e, f, g}; } /* #expect: test.ll diff --git a/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-1.c3t b/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-1.c3t index bbc361eff..1c1b89eb4 100644 --- a/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-1.c3t +++ b/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-1.c3t @@ -145,18 +145,18 @@ extern fn int f_va_callee(int, ...); fn void f_va_caller() { float128 fq; - f_va_callee(1, 2, 3i64, 4.0f, 5.0, Tiny{6, 7, 8, 9}, - Small{10, null}, Small_aligned{11}, - Large{12, 13, 14, 15}); + f_va_callee(1, 2, 3i64, 4.0f, 5.0, (Tiny){6, 7, 8, 9}, + (Small){10, null}, (Small_aligned){11}, + (Large){12, 13, 14, 15}); f_va_callee(1, 2, 3, 4, fq, 6, 7, 8, 9); - f_va_callee(1, 2, 3, 4, Small_aligned{5}, 6, 7, 8, 9); - f_va_callee(1, 2, 3, 4, Small{5,null}, 6, 7, 8, 9); + f_va_callee(1, 2, 3, 4, (Small_aligned){5}, 6, 7, 8, 9); + f_va_callee(1, 2, 3, 4, (Small){5,null}, 6, 7, 8, 9); f_va_callee(1, 2, 3, 4, 5, fq, 7, 8, 9); - f_va_callee(1, 2, 3, 4, 5, Small_aligned{6}, 7, 8, 9); - f_va_callee(1, 2, 3, 4, 5, Small{6, null}, 7, 8, 9); + f_va_callee(1, 2, 3, 4, 5, (Small_aligned){6}, 7, 8, 9); + f_va_callee(1, 2, 3, 4, 5, (Small){6, null}, 7, 8, 9); f_va_callee(1, 2, 3, 4, 5, 6, fq, 8, 9); - f_va_callee(1, 2, 3, 4, 5, 6, Small_aligned{7}, 8, 9); - f_va_callee(1, 2, 3, 4, 5, 6, Small{7, null}, 8, 9); + f_va_callee(1, 2, 3, 4, 5, 6, (Small_aligned){7}, 8, 9); + f_va_callee(1, 2, 3, 4, 5, 6, (Small){7, null}, 8, 9); } diff --git a/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-2.c3t b/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-2.c3t index 73a140278..23a674e8f 100644 --- a/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-2.c3t +++ b/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-2.c3t @@ -146,18 +146,18 @@ extern fn int f_va_callee(int, ...); fn void f_va_caller() { float128 fq; - f_va_callee(1, 2, 3i64, 4.0f, 5.0, Tiny{6, 7, 8, 9}, - Small{10, null}, Small_aligned{11}, - Large{12, 13, 14, 15}); + f_va_callee(1, 2, 3i64, 4.0f, 5.0, (Tiny){6, 7, 8, 9}, + (Small){10, null}, (Small_aligned){11}, + (Large){12, 13, 14, 15}); f_va_callee(1, 2, 3, 4, fq, 6, 7, 8, 9); - f_va_callee(1, 2, 3, 4, Small_aligned{5}, 6, 7, 8, 9); - f_va_callee(1, 2, 3, 4, Small{5,null}, 6, 7, 8, 9); + f_va_callee(1, 2, 3, 4, (Small_aligned){5}, 6, 7, 8, 9); + f_va_callee(1, 2, 3, 4, (Small){5,null}, 6, 7, 8, 9); f_va_callee(1, 2, 3, 4, 5, fq, 7, 8, 9); - f_va_callee(1, 2, 3, 4, 5, Small_aligned{6}, 7, 8, 9); - f_va_callee(1, 2, 3, 4, 5, Small{6, null}, 7, 8, 9); + f_va_callee(1, 2, 3, 4, 5, (Small_aligned){6}, 7, 8, 9); + f_va_callee(1, 2, 3, 4, 5, (Small){6, null}, 7, 8, 9); f_va_callee(1, 2, 3, 4, 5, 6, fq, 8, 9); - f_va_callee(1, 2, 3, 4, 5, 6, Small_aligned{7}, 8, 9); - f_va_callee(1, 2, 3, 4, 5, 6, Small{7, null}, 8, 9); + f_va_callee(1, 2, 3, 4, 5, 6, (Small_aligned){7}, 8, 9); + f_va_callee(1, 2, 3, 4, 5, 6, (Small){7, null}, 8, 9); } diff --git a/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-3.c3t b/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-3.c3t index 640e25f84..b9b9a2531 100644 --- a/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-3.c3t +++ b/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-3.c3t @@ -146,18 +146,18 @@ extern fn int f_va_callee(int, ...); fn void f_va_caller() { float128 fq; - f_va_callee(1, 2, 3i64, 4.0f, 5.0, Tiny{6, 7, 8, 9}, - Small{10, null}, Small_aligned{11}, - Large{12, 13, 14, 15}); + f_va_callee(1, 2, 3i64, 4.0f, 5.0, (Tiny){6, 7, 8, 9}, + (Small){10, null}, (Small_aligned){11}, + (Large){12, 13, 14, 15}); f_va_callee(1, 2, 3, 4, fq, 6, 7, 8, 9); - f_va_callee(1, 2, 3, 4, Small_aligned{5}, 6, 7, 8, 9); - f_va_callee(1, 2, 3, 4, Small{5,null}, 6, 7, 8, 9); + f_va_callee(1, 2, 3, 4, (Small_aligned){5}, 6, 7, 8, 9); + f_va_callee(1, 2, 3, 4, (Small){5,null}, 6, 7, 8, 9); f_va_callee(1, 2, 3, 4, 5, fq, 7, 8, 9); - f_va_callee(1, 2, 3, 4, 5, Small_aligned{6}, 7, 8, 9); - f_va_callee(1, 2, 3, 4, 5, Small{6, null}, 7, 8, 9); + f_va_callee(1, 2, 3, 4, 5, (Small_aligned){6}, 7, 8, 9); + f_va_callee(1, 2, 3, 4, 5, (Small){6, null}, 7, 8, 9); f_va_callee(1, 2, 3, 4, 5, 6, fq, 8, 9); - f_va_callee(1, 2, 3, 4, 5, 6, Small_aligned{7}, 8, 9); - f_va_callee(1, 2, 3, 4, 5, 6, Small{7, null}, 8, 9); + f_va_callee(1, 2, 3, 4, 5, 6, (Small_aligned){7}, 8, 9); + f_va_callee(1, 2, 3, 4, 5, 6, (Small){7, null}, 8, 9); } diff --git a/test/test_suite/abi/small_struct_x64.c3t b/test/test_suite/abi/small_struct_x64.c3t index 984c6b2fc..8bf57d9fe 100644 --- a/test/test_suite/abi/small_struct_x64.c3t +++ b/test/test_suite/abi/small_struct_x64.c3t @@ -9,13 +9,13 @@ struct Foo fn int testing() { - Foo y = getFoo(Foo { 4, 5, 6 }); + Foo y = getFoo((Foo) { 4, 5, 6 }); return y.a + y.c; } fn Foo getFoo(Foo f) { - return Foo { 1, 2, 3 }; + return (Foo) { 1, 2, 3 }; } /* #expect: test.ll diff --git a/test/test_suite/abi/sysv_direct_coerce.c3t b/test/test_suite/abi/sysv_direct_coerce.c3t index ab532c968..f33ade62b 100644 --- a/test/test_suite/abi/sysv_direct_coerce.c3t +++ b/test/test_suite/abi/sysv_direct_coerce.c3t @@ -11,7 +11,7 @@ struct Rectangle fn void test(Rectangle r) { - test(Rectangle { 1, 2, 3, 4 }); + test((Rectangle) { 1, 2, 3, 4 }); } /* #expect: foo.ll diff --git a/test/test_suite/abi/vec2_aarch64.c3t b/test/test_suite/abi/vec2_aarch64.c3t index 47603cade..20e8e5295 100644 --- a/test/test_suite/abi/vec2_aarch64.c3t +++ b/test/test_suite/abi/vec2_aarch64.c3t @@ -5,12 +5,12 @@ struct Vector2 { float x; float y; } -fn Vector2 vector2_zero() @extern("vector2_zero") { return Vector2 {}; } -fn Vector2 vector2_one() @extern("vector2_one") { return Vector2 {}; } -fn Vector2 vector2_add(Vector2 v1, Vector2 v2) @extern("vector2_add") { return Vector2 {}; } -fn Vector2 vector2_add_value(Vector2 v, float add) @extern("vector2_add_value") { return Vector2 {}; } -fn Vector2 vector2_subtract(Vector2 v1, Vector2 v2) @extern("vector2_subtract") { return Vector2 {}; } -fn Vector2 vector2_subtract_value(Vector2 v, float sub) @extern("vector2_subtract_value") { return Vector2 {}; } +fn Vector2 vector2_zero() @extern("vector2_zero") { return {}; } +fn Vector2 vector2_one() @extern("vector2_one") { return {}; } +fn Vector2 vector2_add(Vector2 v1, Vector2 v2) @extern("vector2_add") { return {}; } +fn Vector2 vector2_add_value(Vector2 v, float add) @extern("vector2_add_value") { return {}; } +fn Vector2 vector2_subtract(Vector2 v1, Vector2 v2) @extern("vector2_subtract") { return {}; } +fn Vector2 vector2_subtract_value(Vector2 v, float sub) @extern("vector2_subtract_value") { return {}; } /* #expect: abi.ll diff --git a/test/test_suite/abi/vec2_wasm.c3t b/test/test_suite/abi/vec2_wasm.c3t index d22fda662..0a07e9ce4 100644 --- a/test/test_suite/abi/vec2_wasm.c3t +++ b/test/test_suite/abi/vec2_wasm.c3t @@ -5,12 +5,12 @@ struct Vector2 { float x; float y; } -fn Vector2 vector2_zero() @extern("vector2_zero") { return Vector2 {}; } -fn Vector2 vector2_one() @extern("vector2_one") { return Vector2 {}; } -fn Vector2 vector2_add(Vector2 v1, Vector2 v2) @extern("vector2_add") { return Vector2 {}; } -fn Vector2 vector2_add_value(Vector2 v, float add) @extern("vector2_add_value") { return Vector2 {}; } -fn Vector2 vector2_subtract(Vector2 v1, Vector2 v2) @extern("vector2_subtract") { return Vector2 {}; } -fn Vector2 vector2_subtract_value(Vector2 v, float sub) @extern("vector2_subtract_value") { return Vector2 {}; } +fn Vector2 vector2_zero() @extern("vector2_zero") { return {}; } +fn Vector2 vector2_one() @extern("vector2_one") { return {}; } +fn Vector2 vector2_add(Vector2 v1, Vector2 v2) @extern("vector2_add") { return {}; } +fn Vector2 vector2_add_value(Vector2 v, float add) @extern("vector2_add_value") { return {}; } +fn Vector2 vector2_subtract(Vector2 v1, Vector2 v2) @extern("vector2_subtract") { return {}; } +fn Vector2 vector2_subtract_value(Vector2 v, float sub) @extern("vector2_subtract_value") { return {}; } /* #expect: abi.ll diff --git a/test/test_suite/abi/vec2_x64.c3t b/test/test_suite/abi/vec2_x64.c3t index 1915d1f0a..2ac743251 100644 --- a/test/test_suite/abi/vec2_x64.c3t +++ b/test/test_suite/abi/vec2_x64.c3t @@ -5,12 +5,12 @@ struct Vector2 { float x; float y; } -fn Vector2 vector2_zero() @extern("vector2_zero") { return Vector2 {}; } -fn Vector2 vector2_one() @extern("vector2_one") { return Vector2 {}; } -fn Vector2 vector2_add(Vector2 v1, Vector2 v2) @extern("vector2_add") { return Vector2 {}; } -fn Vector2 vector2_add_value(Vector2 v, float add) @extern("vector2_add_value") { return Vector2 {}; } -fn Vector2 vector2_subtract(Vector2 v1, Vector2 v2) @extern("vector2_subtract") { return Vector2 {}; } -fn Vector2 vector2_subtract_value(Vector2 v, float sub) @extern("vector2_subtract_value") { return Vector2 {}; } +fn Vector2 vector2_zero() @extern("vector2_zero") { return {}; } +fn Vector2 vector2_one() @extern("vector2_one") { return {}; } +fn Vector2 vector2_add(Vector2 v1, Vector2 v2) @extern("vector2_add") { return {}; } +fn Vector2 vector2_add_value(Vector2 v, float add) @extern("vector2_add_value") { return {}; } +fn Vector2 vector2_subtract(Vector2 v1, Vector2 v2) @extern("vector2_subtract") { return {}; } +fn Vector2 vector2_subtract_value(Vector2 v, float sub) @extern("vector2_subtract_value") { return {}; } /* #expect: abi.ll diff --git a/test/test_suite/arrays/array_bounds_check.c3t b/test/test_suite/arrays/array_bounds_check.c3t index 77553df82..af971dfdb 100644 --- a/test/test_suite/arrays/array_bounds_check.c3t +++ b/test/test_suite/arrays/array_bounds_check.c3t @@ -3,7 +3,7 @@ module testing; import std::io; -const FOO = Foo[2]{ {11}, {22} }; +const FOO = (Foo[2]){ {11}, {22} }; struct Foo { diff --git a/test/test_suite/arrays/inferred_subarray.c3 b/test/test_suite/arrays/inferred_subarray.c3 index 684a1cd91..c8258fa30 100644 --- a/test/test_suite/arrays/inferred_subarray.c3 +++ b/test/test_suite/arrays/inferred_subarray.c3 @@ -1,5 +1,5 @@ fn void main() { - int[?][?][] x = int[2][1][] { { { 1, 2 } } }; - int[?][?][?] y = int[2][1][] { { { 1, 2 } } }; + int[?][?][] x = (int[2][1][]) { { { 1, 2 } } }; + int[?][?][?] y = (int[2][1][]) { { { 1, 2 } } }; } diff --git a/test/test_suite/bitstruct/bitstruct_cast_const_init.c3t b/test/test_suite/bitstruct/bitstruct_cast_const_init.c3t index 42faeb11b..d1503ab39 100644 --- a/test/test_suite/bitstruct/bitstruct_cast_const_init.c3t +++ b/test/test_suite/bitstruct/bitstruct_cast_const_init.c3t @@ -9,7 +9,7 @@ bitstruct Foo : int fn void main() { Foo f; - int z = (int) Foo { .abc = 2, .defg = 1 }; + int z = (int) (Foo) { .abc = 2, .defg = 1 }; } /* #expect: test.ll diff --git a/test/test_suite/bitstruct/bitstruct_ops.c3t b/test/test_suite/bitstruct/bitstruct_ops.c3t index f504043d6..f6439f669 100644 --- a/test/test_suite/bitstruct/bitstruct_ops.c3t +++ b/test/test_suite/bitstruct/bitstruct_ops.c3t @@ -23,7 +23,7 @@ fn void main() io::printfn("%s %s", f3.a, f3.b); Foo f4 = (f1 | ~f2) ^ f3; io::printfn("%s %s", f4.a, f4.b); - Foo f5 = Foo { true, false } | Foo { false, true }; + Foo f5 = (Foo) { true, false } | (Foo) { false, true }; io::printfn("%s %s", f5.a, f5.b); f5 &= f2; @@ -36,7 +36,7 @@ fn void main() io::printfn("%s %s %s", b3.z, b3.w, b3.gh); b3 = ~b3; io::printfn("%s %s %s", b3.z, b3.w, b3.gh); - b3 ^= Bar { true, true, false }; + b3 ^= (Bar) { true, true, false }; io::printfn("%s %s %s", b3.z, b3.w, b3.gh); } diff --git a/test/test_suite/bitstruct/designated_initializer_with_bitstruct.c3t b/test/test_suite/bitstruct/designated_initializer_with_bitstruct.c3t index 2b18afcda..672bc81b0 100644 --- a/test/test_suite/bitstruct/designated_initializer_with_bitstruct.c3t +++ b/test/test_suite/bitstruct/designated_initializer_with_bitstruct.c3t @@ -39,10 +39,10 @@ struct Foo4 fn void main() { void* foo; - Foo *f = &&Foo { .expand = 2, .widget = &f }; - Foo2 *f2 = &&Foo2 { .expand = 2, .widget = &f }; - Foo3 *f3 = &&Foo3 { .expand = 2, .a = true, .b = true, .widget = &f }; - Foo4 *f4 = &&Foo4 { .expand = 2, .a = true, .b = true, .widget = &f }; + Foo *f = &&(Foo) { .expand = 2, .widget = &f }; + Foo2 *f2 = &&(Foo2) { .expand = 2, .widget = &f }; + Foo3 *f3 = &&(Foo3) { .expand = 2, .a = true, .b = true, .widget = &f }; + Foo4 *f4 = &&(Foo4) { .expand = 2, .a = true, .b = true, .widget = &f }; } /* #expect: testing.ll diff --git a/test/test_suite/builtins/reduce_arithmetics.c3t b/test/test_suite/builtins/reduce_arithmetics.c3t index 49601fb29..5a27bceff 100644 --- a/test/test_suite/builtins/reduce_arithmetics.c3t +++ b/test/test_suite/builtins/reduce_arithmetics.c3t @@ -5,21 +5,21 @@ import std::io; fn void main() { int a; - io::printfn("%s", $$pow_int(double[<2>] { 23.3, 2.1 }, 3)); - io::printfn("%s", $$reduce_add(int[<2>] { 3, 10 })); - io::printfn("%s", $$reduce_fadd(double[<2>] { 3, 10 }, -0.0)); - io::printfn("%s", $$reduce_fadd(double[<2>] { 3, 10 }, 3.2)); - io::printfn("%s", $$reduce_mul(int[<2>] { 3, 10 })); - io::printfn("%s", $$reduce_fmul(double[<2>] { 3, 10 }, 3.4)); - io::printfn("%s", $$reduce_and(int[<2>] { 3, 11 })); - io::printfn("%s", $$reduce_or(int[<2>] { 3, 10 })); - io::printfn("%s", $$reduce_xor(int[<2>] { 3, 10 })); - io::printfn("%s", $$reduce_max(double[<2>] { 23.2, 23.3 })); - io::printfn("%s", $$reduce_max(int[<2>] { -23, 32 })); - io::printfn("%s", $$reduce_max(char[<2>] { 4, 253 })); - io::printfn("%s", $$reduce_min(double[<2>] { 23.2, 23.3 })); - io::printfn("%s", $$reduce_min(int[<2>] { -23, 32 })); - io::printfn("%s", $$reduce_min(char[<2>] { 4, 253 })); + io::printfn("%s", $$pow_int((double[<2>]) { 23.3, 2.1 }, 3)); + io::printfn("%s", $$reduce_add((int[<2>]) { 3, 10 })); + io::printfn("%s", $$reduce_fadd((double[<2>]) { 3, 10 }, -0.0)); + io::printfn("%s", $$reduce_fadd((double[<2>]) { 3, 10 }, 3.2)); + io::printfn("%s", $$reduce_mul((int[<2>]) { 3, 10 })); + io::printfn("%s", $$reduce_fmul((double[<2>]) { 3, 10 }, 3.4)); + io::printfn("%s", $$reduce_and((int[<2>]) { 3, 11 })); + io::printfn("%s", $$reduce_or((int[<2>]) { 3, 10 })); + io::printfn("%s", $$reduce_xor((int[<2>]) { 3, 10 })); + io::printfn("%s", $$reduce_max((double[<2>]) { 23.2, 23.3 })); + io::printfn("%s", $$reduce_max((int[<2>]) { -23, 32 })); + io::printfn("%s", $$reduce_max((char[<2>]) { 4, 253 })); + io::printfn("%s", $$reduce_min((double[<2>]) { 23.2, 23.3 })); + io::printfn("%s", $$reduce_min((int[<2>]) { -23, 32 })); + io::printfn("%s", $$reduce_min((char[<2>]) { 4, 253 })); } diff --git a/test/test_suite/builtins/sat_builtins.c3t b/test/test_suite/builtins/sat_builtins.c3t index 4a10937ee..4b41a6215 100644 --- a/test/test_suite/builtins/sat_builtins.c3t +++ b/test/test_suite/builtins/sat_builtins.c3t @@ -18,7 +18,7 @@ fn void main() ichar[<2>] w = { -44, 30 }; io::printfn("%s %s", $$sat_add(x, y), $$sat_add(z, z)); io::printfn("%s %s", $$sat_sub(x, y), $$sat_sub(w, z)); - io::printfn("%s %s", $$sat_shl(x, char[<2>] { 1, 1 }), $$sat_shl(z, ichar[<2>] { 1, 1 })); + io::printfn("%s %s", $$sat_shl(x, (char[<2>]) { 1, 1 }), $$sat_shl(z, (ichar[<2>]) { 1, 1 })); } /* #expect: test.ll diff --git a/test/test_suite/builtins/shufflevector.c3t b/test/test_suite/builtins/shufflevector.c3t index c883e7882..4faa45d87 100644 --- a/test/test_suite/builtins/shufflevector.c3t +++ b/test/test_suite/builtins/shufflevector.c3t @@ -23,7 +23,7 @@ struct Matrix2x2 fn float[<2>] apply1(Matrix2x2* mat, float[<2>] vec) { - return float[<2>] { + return (float[<2>]) { mat.m00 * vec[0] + mat.m01 * vec[1], mat.m10 * vec[0] + mat.m11 * vec[1], }; @@ -31,7 +31,7 @@ fn float[<2>] apply1(Matrix2x2* mat, float[<2>] vec) fn float[<2>] apply2(Matrix2x2* mat, float[<2>] vec) { - return float[<2>] { + return (float[<2>]) { mat.m0[0] * vec[0] + mat.m0[1] * vec[1], mat.m1[0] * vec[0] + mat.m1[1] * vec[1], }; @@ -49,9 +49,9 @@ fn float[<2>] apply3(Matrix2x2* mat, float[<2>] vec) fn void main() { Matrix2x2 a = { 1, -3, 5, -7 }; - io::printfn("1: %s", apply1(&a, float[<2>] { 11, 13 })); - io::printfn("2: %s", apply2(&a, float[<2>] { 11, 13 })); - io::printfn("3: %s", apply3(&a, float[<2>] { 11, 13 })); + io::printfn("1: %s", apply1(&a, (float[<2>]) { 11, 13 })); + io::printfn("2: %s", apply2(&a, (float[<2>]) { 11, 13 })); + io::printfn("3: %s", apply3(&a, (float[<2>]) { 11, 13 })); } /* #expect: test.ll diff --git a/test/test_suite/cast/cast_bitstruct_etc.c3t b/test/test_suite/cast/cast_bitstruct_etc.c3t index daee17bd4..c99822a61 100644 --- a/test/test_suite/cast/cast_bitstruct_etc.c3t +++ b/test/test_suite/cast/cast_bitstruct_etc.c3t @@ -4,8 +4,8 @@ module test; fn void main() { Enum e = ENUM1; - ushort x = (ushort)Foo{ .x = e }; - Foo z = (Foo)(ushort)Foo { .x = e }; + ushort x = (ushort)(Foo){ .x = e }; + Foo z = (Foo)(ushort)(Foo) { .x = e }; } enum Enum : char diff --git a/test/test_suite/cast/cast_ok.c3 b/test/test_suite/cast/cast_ok.c3 index 8ce12894c..8c2b57223 100644 --- a/test/test_suite/cast/cast_ok.c3 +++ b/test/test_suite/cast/cast_ok.c3 @@ -7,5 +7,5 @@ fn void test4() fn void test5() { - Foo x = (Foo)(Foo{32}); + Foo x = (Foo)((Foo){32}); } \ No newline at end of file diff --git a/test/test_suite/cast/cast_parse_fails.c3 b/test/test_suite/cast/cast_parse_fails.c3 index d8634e65f..8a6c90a47 100644 --- a/test/test_suite/cast/cast_parse_fails.c3 +++ b/test/test_suite/cast/cast_parse_fails.c3 @@ -2,7 +2,7 @@ struct Foo { int a; } fn void test2() { - int x = int{ 32 }; // #error: 'int' with a non-empty initializer list + int x = (int){ 32 }; // #error: 'int' with a non-empty initializer list } fn void test3() diff --git a/test/test_suite/cast/cast_rcast.c3 b/test/test_suite/cast/cast_rcast.c3 index 2f310fc27..92484c037 100644 --- a/test/test_suite/cast/cast_rcast.c3 +++ b/test/test_suite/cast/cast_rcast.c3 @@ -9,7 +9,7 @@ bitstruct Image_Tag : uint } distinct Glyph_Format = CInt; -const Glyph_Format GLYPH_FORMAT_BITMAP = (Glyph_Format)Image_Tag {'b', 'i', 't', 's'}; +const Glyph_Format GLYPH_FORMAT_BITMAP = (Glyph_Format)(Image_Tag) {'b', 'i', 't', 's'}; fn void main() { // Error: Implicitly casting 'Image_Tag' to 'Glyph_Format' is not permitted diff --git a/test/test_suite/compile_time/compile_time_access_subscript.c3t b/test/test_suite/compile_time/compile_time_access_subscript.c3t index aeb3d4582..f797b254e 100644 --- a/test/test_suite/compile_time/compile_time_access_subscript.c3t +++ b/test/test_suite/compile_time/compile_time_access_subscript.c3t @@ -6,16 +6,16 @@ struct Abc float m00, m01, m10, m11; } -Abc a = flip(Abc { 1, 2, 3, 4 }); +Abc a = flip((Abc) { 1, 2, 3, 4 }); macro flip($init) { - return Abc { $init.m01, $init.m10, $init.m11, $init.m00 }; + return (Abc) { $init.m01, $init.m10, $init.m11, $init.m00 }; } macro check_type($Type) { - var $b = $Type[4][4] {}; + var $b = ($Type[4][4]) {}; $Type z = $b[2][2]; return z; } @@ -25,9 +25,9 @@ enum Blurb { FOO } distinct Bdd = Abc; fn void main() { - var $i = int[4] { 1, 2, 3, 4 }; - var $b = Abc[2] { Abc {}, Abc { 11, 22, 33, 44 }}; - var $c = any[4] {}; + var $i = (int[4]) { 1, 2, 3, 4 }; + var $b = (Abc[2]) { (Abc) {}, (Abc) { 11, 22, 33, 44 }}; + var $c = (any[4]) {}; check_type(int); check_type(Abc); check_type(anyfault); diff --git a/test/test_suite/compile_time/comptime_array_folding.c3t b/test/test_suite/compile_time/comptime_array_folding.c3t index d4c782417..1a7198140 100644 --- a/test/test_suite/compile_time/comptime_array_folding.c3t +++ b/test/test_suite/compile_time/comptime_array_folding.c3t @@ -3,26 +3,30 @@ module test; import std; def @TaggedAttr(value) = { - @tag("foo", ValueHere[?]{ value }) + @tag("foo", (ValueHere[?]){ value }) }; const FOO_STR = "foo"; -union TestUnion { +union TestUnion +{ int a; } -struct ValueHere { +struct ValueHere +{ int value; String thing; } const ValueHere VALUE_STRUCT = { 32, "lol" }; -struct ThisOtherStruct @TaggedAttr(VALUE_STRUCT) { +struct ThisOtherStruct @TaggedAttr(VALUE_STRUCT) +{ int something; } -enum Example : int (String str) @TaggedAttr(VALUE_STRUCT) { +enum Example : int (String str) @TaggedAttr(VALUE_STRUCT) +{ FOO = FOO_STR, } @@ -32,7 +36,8 @@ const int BAZ2 = BAZ[1]; const TestUnion[1] ABC = { { .a = 112 } }; const TestUnion BCD = ABC[0]; -macro int get_tag_value($Type) { +macro int get_tag_value($Type) +{ $if $Type.has_tagof("foo"): return $Type.tagof("foo")[0].value; $else diff --git a/test/test_suite/compile_time/concat_append.c3t b/test/test_suite/compile_time/concat_append.c3t index 0d0bfbf7b..2b2b92d3f 100644 --- a/test/test_suite/compile_time/concat_append.c3t +++ b/test/test_suite/compile_time/concat_append.c3t @@ -3,13 +3,13 @@ module test; macro foo() { var c = "hello" +++ " world"; - String[?] a = String[1] { "hello" } +++ String[1] { " world" }; + String[?] a = (String[1]) { "hello" } +++ (String[1]) { " world" }; int[2] $a = { 1, 2 }; $a = $a +++ 100; int z = $typeof($a).len; var b = $a; - var d = int[]{} +++ 1 +++ 2 +++ 3; - var e = String[1] { "hello... " } +++ " there!"; + var d = (int[]){} +++ 1 +++ 2 +++ 3; + var e = (String[1]) { "hello... " } +++ " there!"; var f = "" +++ ""; var g = "bye"; var h = $$str_hash("helloworld"); diff --git a/test/test_suite/compile_time/concat_test_cases.c3 b/test/test_suite/compile_time/concat_test_cases.c3 index 9be8b1eab..21c291d0f 100644 --- a/test/test_suite/compile_time/concat_test_cases.c3 +++ b/test/test_suite/compile_time/concat_test_cases.c3 @@ -1,19 +1,19 @@ fn void main(String[] args) { - var $x = int[2]{ 1, 2 } +++ int[2]{ 4, 5 }; + var $x = (int[2]){ 1, 2 } +++ (int[2]){ 4, 5 }; var $v = "foo" +++ "baz" +++ '!' +++ '?'; var $b = x'403322' +++ "baz"; var $b2 = x'40334a' +++ 55 +++ 55; - var $b3 = x'403322' +++ char[2] { 1, 2 }; - var $b4 = x'403322' +++ char[2] { 1, 2 }; + var $b3 = x'403322' +++ (char[2]) { 1, 2 }; + var $b4 = x'403322' +++ (char[2]) { 1, 2 }; var $b5 = "foo" +++ { 55, 57 }; - var $b6 = ((ichar[3])x'403322') +++ ichar[2] { 1, 2 }; - var $b7 = char[2] { 1, 2 } +++ "foo"; + var $b6 = ((ichar[3])x'403322') +++ (ichar[2]) { 1, 2 }; + var $b7 = (char[2]) { 1, 2 } +++ "foo"; assert($b7 == { 1, 2, 102, 111, 111}); assert($b5 == "foo79"); assert($b3 == $b4); assert($b6 == { 0x40, 0x33, 0x22, 1, 2 }); - int[4] $x2 = int[2]{ 1, 2 }+++ int[2]{ 4, 5 }; + int[4] $x2 = (int[2]){ 1, 2 }+++ (int[2]){ 4, 5 }; int[4] $y = { 1, 2 } +++ { 4, 5 }; assert($x == {1, 2, 4, 5}); assert($x2 == {1, 2, 4, 5}); diff --git a/test/test_suite/compile_time/ct_declaration_in_if.c3t b/test/test_suite/compile_time/ct_declaration_in_if.c3t index cb246c666..e1b4671cf 100644 --- a/test/test_suite/compile_time/ct_declaration_in_if.c3t +++ b/test/test_suite/compile_time/ct_declaration_in_if.c3t @@ -17,7 +17,7 @@ macro @printVecs(Vector3... vectors) fn void main() { - @printVecs(Vector3{10, 5, 3}, Vector3{9, 6, 4}, Vector3{5, 4, 3}); + @printVecs({10, 5, 3}, {9, 6, 4}, {5, 4, 3}); } /* #expect: test.ll diff --git a/test/test_suite/dynamic/dynamic_tracing.c3t b/test/test_suite/dynamic/dynamic_tracing.c3t index 0df0e7080..c1f0482e1 100644 --- a/test/test_suite/dynamic/dynamic_tracing.c3t +++ b/test/test_suite/dynamic/dynamic_tracing.c3t @@ -37,7 +37,7 @@ macro @patch(IFoo *x, $Type) { } fn void main() { - IFoo foo = @clone(Ba{}); + IFoo foo = @clone((Ba){}); io::printfn("Aa.typeid: %p, Ba.typeid: %p", (usz) Aa.typeid, (usz) Ba.typeid); io::printfn("foo.type: %p", (usz) foo.type); diff --git a/test/test_suite/errors/error_regression_2.c3t b/test/test_suite/errors/error_regression_2.c3t index 7344d1460..12649f621 100644 --- a/test/test_suite/errors/error_regression_2.c3t +++ b/test/test_suite/errors/error_regression_2.c3t @@ -55,19 +55,19 @@ fn Doc! readDoc(char[] url) { if (contains(url, "fail")) return ReadError.BAD_READ?; if (contains(url, "head-missing")) return { .head = null }; - if (contains(url, "title-missing")) return { dupe(Head { .title = null })! }; - if (contains(url, "title-empty")) return { dupe(Head { .title = dupe((char[])"")! })! }; + if (contains(url, "title-missing")) return { dupe((Head) { .title = null })! }; + if (contains(url, "title-empty")) return { dupe((Head) { .title = dupe((char[])"")! })! }; // Not particularly elegant due to missing string functions. isz len = libc::snprintf(null, 0, "Title of %.*s", (int)url.len, url.ptr); char* str = malloc(len + 1); if (!str) return ReadError.OUT_OF_MEMORY?; libc::snprintf(str, len + 1, "Title of %.*s", (int)url.len, url.ptr); - return { dupe(Head { .title = dupe(str[..len - 1])! })! }; + return { dupe((Head) { .title = dupe(str[..len - 1])! })! }; } fn Summary buildSummary(Doc doc) { - return Summary { + return { .title = doc.head ? doc.head.title : null, .ok = true, }; @@ -75,7 +75,7 @@ fn Summary buildSummary(Doc doc) fn Summary readAndBuildSummary(char[] url) { - return buildSummary(readDoc(url)) ?? Summary { .title = null, .ok = false }; + return buildSummary(readDoc(url)) ?? (Summary) { .title = null, .ok = false }; /* // or Summary summary = buildSummary(readDoc(url)); diff --git a/test/test_suite/errors/optional_designated.c3 b/test/test_suite/errors/optional_designated.c3 index ccc65c05a..e141767e6 100644 --- a/test/test_suite/errors/optional_designated.c3 +++ b/test/test_suite/errors/optional_designated.c3 @@ -4,7 +4,7 @@ struct Foo { int a; } struct Bar { int b; Foo f; } fn void main() { - Bar { .f = Foo { foo() } }; // #error: not be discarded + (Bar) { .f = (Foo) { foo() } }; // #error: not be discarded } fn int! foo() => 1; \ No newline at end of file diff --git a/test/test_suite/errors/optional_taddr_and_access.c3t b/test/test_suite/errors/optional_taddr_and_access.c3t index 5bec60fb4..95bfbbd2f 100644 --- a/test/test_suite/errors/optional_taddr_and_access.c3t +++ b/test/test_suite/errors/optional_taddr_and_access.c3t @@ -16,10 +16,10 @@ extern fn int printf(char *c, ...); fn void main() { int! z = 2; - Foo*! w = &&Foo{ z, 0 }; + Foo*! w = &&(Foo){ z, 0 }; (void)printf("%d\n", w.x); z = MyErr.FOO?; - w = &&Foo{ z, 0 }; + w = &&(Foo){ z, 0 }; (void)printf("Not visible: %d\n", w.x); } diff --git a/test/test_suite/generic/generic_lambda_complex.c3t b/test/test_suite/generic/generic_lambda_complex.c3t index 76b281b14..e10d53993 100644 --- a/test/test_suite/generic/generic_lambda_complex.c3t +++ b/test/test_suite/generic/generic_lambda_complex.c3t @@ -68,13 +68,13 @@ fn void! TextTemplate.init(&self, String template, String tag_start = "{{", Stri { $switch ($m.typeid) $case String.typeid: - return TextTag{ + return (TextTag){ .kind = STRING, .data = (String*)(data + $m.offsetof), }; $default: $if $defined($m.get(self.data).as_stream): - return TextTag{ + return (TextTag){ .kind = TEMPLATE, .template = self.data.$eval($m.nameof).as_stream(), }; diff --git a/test/test_suite/generic/used_without_param.c3 b/test/test_suite/generic/used_without_param.c3 index f5892945f..950c3b12f 100644 --- a/test/test_suite/generic/used_without_param.c3 +++ b/test/test_suite/generic/used_without_param.c3 @@ -3,6 +3,6 @@ import std::collections::maybe; fn void main() { - maybe::Maybe() f = Maybe {.value=6.6, .has_value=true}; // #error: Did you mean the struct - maybe::Maybe()g = Maybe {.value=8, .has_value=true}; + Maybe() f = (Maybe) {.value=6.6, .has_value=true}; // #error: Did you mean the struct + Maybe()g = (Maybe) {.value=8, .has_value=true}; } diff --git a/test/test_suite/generic/used_without_param2.c3 b/test/test_suite/generic/used_without_param2.c3 index 7d9f22d38..3fc231a3d 100644 --- a/test/test_suite/generic/used_without_param2.c3 +++ b/test/test_suite/generic/used_without_param2.c3 @@ -3,7 +3,7 @@ import std::collections::maybe; fn void test() { - maybe::Maybe() f = Maybe {.value=6.6, .has_value=true}; // #error: Did you mean the struct + maybe::Maybe() f = (Maybe) {.value=6.6, .has_value=true}; // #error: Did you mean the struct Maybe x; // #error: Did you mean the struct } diff --git a/test/test_suite/generic/used_without_param3.c3 b/test/test_suite/generic/used_without_param3.c3 index 413c83686..6ba0b4fd4 100644 --- a/test/test_suite/generic/used_without_param3.c3 +++ b/test/test_suite/generic/used_without_param3.c3 @@ -3,5 +3,5 @@ import std::collections::maybe; fn void test() { - maybe::Maybe() f = Maybe {.value=6.6, .has_value=true}; // #error: Did you mean the struct + maybe::Maybe() f = (Maybe) {.value=6.6, .has_value=true}; // #error: Did you mean the struct } \ No newline at end of file diff --git a/test/test_suite/initialize/init_non_resolved_type.c3 b/test/test_suite/initialize/init_non_resolved_type.c3 index 892846c1c..6809310fe 100644 --- a/test/test_suite/initialize/init_non_resolved_type.c3 +++ b/test/test_suite/initialize/init_non_resolved_type.c3 @@ -1 +1 @@ -const IS_ARCH_LITTLE_ENDIAN = (uint)(UIntLE{(uint)1}.val) == 1; // #error: This expression cannot be evaluated at compile time +const IS_ARCH_LITTLE_ENDIAN = (uint)((UIntLE){(uint)1}.val) == 1; // #error: This expression cannot be evaluated at compile time diff --git a/test/test_suite/initializer_lists/general_tests.c3t b/test/test_suite/initializer_lists/general_tests.c3t index 83f28ed21..170afc755 100644 --- a/test/test_suite/initializer_lists/general_tests.c3t +++ b/test/test_suite/initializer_lists/general_tests.c3t @@ -20,7 +20,7 @@ fn int test() int foo2 = $foo[2]; var $foos = { "Hello!" }; char* str = $foos[0]; - bool x = ! int[] { 1, 2, 3 }; + bool x = ! (int[]) { 1, 2, 3 }; Bar b = {}; Baz z = {}; int[] sub = {}; diff --git a/test/test_suite/initializer_lists/infer_with_init.c3t b/test/test_suite/initializer_lists/infer_with_init.c3t index 5479fffa7..260dedb56 100644 --- a/test/test_suite/initializer_lists/infer_with_init.c3t +++ b/test/test_suite/initializer_lists/infer_with_init.c3t @@ -1,11 +1,11 @@ // #target: windows-x64 module test; -const int[?] X = int[?] { 1, 2, 3 }; -int[?] y = int[?] { 1, 2, 3 }; +const int[?] X = (int[?]) { 1, 2, 3 }; +int[?] y = (int[?]) { 1, 2, 3 }; fn void main() { - int x = $typeof(int[?] { 1, 2, 3}).len; + int x = $typeof((int[?]) { 1, 2, 3}).len; int z = X.len; int w = y.len; } diff --git a/test/test_suite/initializer_lists/init_any_interface.c3 b/test/test_suite/initializer_lists/init_any_interface.c3 index 46a1dcab4..d58f141de 100644 --- a/test/test_suite/initializer_lists/init_any_interface.c3 +++ b/test/test_suite/initializer_lists/init_any_interface.c3 @@ -10,7 +10,7 @@ struct Bar (Foo) fn int main() { Test() a = {{}}; Test() b = {{}}; - Test() a2 = {Bar{}}; // #error: It is not possible to cast + Test() a2 = {(Bar){}}; // #error: It is not possible to cast return 0; } diff --git a/test/test_suite/initializer_lists/initializers_to_macros.c3 b/test/test_suite/initializer_lists/initializers_to_macros.c3 index 8100fd12a..f464c2625 100644 --- a/test/test_suite/initializer_lists/initializers_to_macros.c3 +++ b/test/test_suite/initializer_lists/initializers_to_macros.c3 @@ -6,6 +6,6 @@ macro test(foo) fn void main() { - test(int[] { 1, 2 }); + test((int[]) { 1, 2 }); test({ 1, 2 }); // #error: It is only possible to use an untyped list as a } \ No newline at end of file diff --git a/test/test_suite/initializer_lists/subarrays.c3t b/test/test_suite/initializer_lists/subarrays.c3t index b154ca5af..b978cb441 100644 --- a/test/test_suite/initializer_lists/subarrays.c3t +++ b/test/test_suite/initializer_lists/subarrays.c3t @@ -17,14 +17,14 @@ struct Bar Bar[] arrbar = { { 3, 4 }, { 8, 9 }}; int[] xd = { 1, 2 }; -int* fofeo = &&(int[2]{ 3, 4 }); +int* fofeo = &&((int[2]){ 3, 4 }); fn int main() { Bar w = arrbar[1]; libc::printf("%d\n", arrbar[1].x); int[] x = { 1, 2, 3 }; - int* y = &&(int[3]{ 123, 234, 567 }); + int* y = &&((int[3]){ 123, 234, 567 }); io::printn("Start:"); libc::printf("X len: %d mid element %d\n", (int)(x.len), x[1]); libc::printf("Y mid element %d\n", y[1]); @@ -33,7 +33,7 @@ fn int main() int[1] azz = {}; //var $foo = { 1, 2, 3 }; - bool xy = ! int[] { 1, 2, 3 }; + bool xy = !(int[]){ 1, 2, 3 }; if (!xy) io::printn("Ok"); Bar b = {}; Baz z = {}; diff --git a/test/test_suite/macros/hash_initializer.c3t b/test/test_suite/macros/hash_initializer.c3t index 6dbf2d3ea..a508a3633 100644 --- a/test/test_suite/macros/hash_initializer.c3t +++ b/test/test_suite/macros/hash_initializer.c3t @@ -7,7 +7,7 @@ macro int[2] test(#abc) @safemacro fn void main() { - int[2] x = int[2] { 1, 2 }; + int[2] x = (int[2]) { 1, 2 }; int[2] y = test({ 2, 3 }); int[2] z = test({ [0] = 1 }); } diff --git a/test/test_suite/methods/method_ref_for_extension_method.c3 b/test/test_suite/methods/method_ref_for_extension_method.c3 index 57d31a636..22d27abdb 100644 --- a/test/test_suite/methods/method_ref_for_extension_method.c3 +++ b/test/test_suite/methods/method_ref_for_extension_method.c3 @@ -12,7 +12,7 @@ fn bool Foo[].is_empty(Foo[] array) { def foo_arr_is_empty = Foo[].is_empty; fn void main() { - Foo[] foos = { Foo { .i = 0 } }; + Foo[] foos = { (Foo) { .i = 0 } }; void* foo = &Foo[].is_empty; io::printfn("Is empty: %s", foos.is_empty()); io::printfn("Is empty: %s", foo_arr_is_empty(foos)); diff --git a/test/test_suite/pointers/const_ref.c3t b/test/test_suite/pointers/const_ref.c3t index 7a6847ab4..13d75b378 100644 --- a/test/test_suite/pointers/const_ref.c3t +++ b/test/test_suite/pointers/const_ref.c3t @@ -1,7 +1,7 @@ // #target: macos-x64 module test; -const int[?] X = int[?] { 1, 2, 3 }; -int[?] y = int[?] { 1, 2, 3 }; +const int[?] X = (int[?]) { 1, 2, 3 }; +int[?] y = (int[?]) { 1, 2, 3 }; fn int main() { diff --git a/test/test_suite/slices/slice_to_slice_assign.c3t b/test/test_suite/slices/slice_to_slice_assign.c3t index 5ef8c0ad9..69c642eb8 100644 --- a/test/test_suite/slices/slice_to_slice_assign.c3t +++ b/test/test_suite/slices/slice_to_slice_assign.c3t @@ -10,8 +10,8 @@ fn void main() io::printfn("%s %s", y, z); y[4..] = z[5..6]; io::printfn("%s %s", y, z); - int[][] a = { int[] { 1 } }; - int[][] b = { int[] { 2 } }; + int[][] a = { (int[]) { 1 } }; + int[][] b = { (int[]) { 2 } }; io::printfn("%s", a); a[0..0] = b[0..0]; io::printfn("%s", a); diff --git a/test/test_suite/slices/slice_to_slice_vector_assign.c3t b/test/test_suite/slices/slice_to_slice_vector_assign.c3t index b3855c06f..abedcf3e3 100644 --- a/test/test_suite/slices/slice_to_slice_vector_assign.c3t +++ b/test/test_suite/slices/slice_to_slice_vector_assign.c3t @@ -10,8 +10,8 @@ fn void main() io::printfn("%s %s", y, z); y[4..] = z[5..6]; io::printfn("%s %s", y, z); - int[][] a = { int[] { 1 } }; - int[][] b = { int[] { 2 } }; + int[][] a = { (int[]) { 1 } }; + int[][] b = { (int[]) { 2 } }; io::printfn("%s", a); a[0..0] = b[0..0]; io::printfn("%s", a); diff --git a/test/test_suite/slices/various_const_slicing.c3t b/test/test_suite/slices/various_const_slicing.c3t index 980d1dde2..6828e0877 100644 --- a/test/test_suite/slices/various_const_slicing.c3t +++ b/test/test_suite/slices/various_const_slicing.c3t @@ -6,12 +6,12 @@ int[] y2 = FOO[1..2]; fn void test() { - int[][] a = { int[] { 1 } }; + int[][] a = { (int[]) { 1 } }; char[4] $a = x'aabbccdd'; var $b = $a[1..2]; char[2] y = $b; - assert($b == char[] { 187, 204 }); - assert(y == char[2] { 187, 204 }); + assert($b == (char[]) { 187, 204 }); + assert(y == (char[2]) { 187, 204 }); } fn int main() diff --git a/test/test_suite/statements/custom_foreach_with_ref.c3t b/test/test_suite/statements/custom_foreach_with_ref.c3t index 6fd71a8fe..bd2093a87 100644 --- a/test/test_suite/statements/custom_foreach_with_ref.c3t +++ b/test/test_suite/statements/custom_foreach_with_ref.c3t @@ -26,7 +26,7 @@ macro int Foo.@operator_element_at(Foo* &f, int a) @operator([]) fn int[5] getFields() { printf("getFields\n"); - return int[5] { 3, 5, 2, 10, 111}; + return (int[5]) { 3, 5, 2, 10, 111}; } fn Foo *call(Foo* f) { @@ -62,7 +62,7 @@ fn void main() i++; } - foreach(i, y : int[5] { 1, 2, 10, 111, 123 } ) + foreach(i, y : (int[5]) { 1, 2, 10, 111, 123 } ) { printf("Adding %d: %d\n", i, y); i++; diff --git a/test/test_suite/stdlib/map_linux.c3t b/test/test_suite/stdlib/map_linux.c3t index a5b11b0df..b88833cff 100644 --- a/test/test_suite/stdlib/map_linux.c3t +++ b/test/test_suite/stdlib/map_linux.c3t @@ -23,14 +23,14 @@ fn void main() IntFooMap map; map.new_init(); io::printfn("Map size: %d", map.count); - map.set(1, Foo { 1, null }); + map.set(1, { 1, null }); io::printfn("Map size: %d", map.count); - map.set(1, Foo { 2, null }); + map.set(1, { 2, null }); io::printfn("Map size: %d", map.count); (void)io::printfn("Val: %d", map.get(1).x); io::printfn("Has 1: %s", map.has_key(1)); io::printfn("Has 2: %s", map.has_key(2)); - map.set(7, Foo { 4, null }); + map.set(7, { 4, null }); io::printfn("Values: %s", map.value_new_list()); IntDoubleMap map2; map2.new_init(); diff --git a/test/test_suite/stdlib/map_macos.c3t b/test/test_suite/stdlib/map_macos.c3t index 98dd533cb..042492e7d 100644 --- a/test/test_suite/stdlib/map_macos.c3t +++ b/test/test_suite/stdlib/map_macos.c3t @@ -23,14 +23,14 @@ fn void main() IntFooMap map; map.new_init(); io::printfn("Map size: %d", map.count); - map.set(1, Foo { 1, null }); + map.set(1, { 1, null }); io::printfn("Map size: %d", map.count); - map.set(1, Foo { 2, null }); + map.set(1, { 2, null }); io::printfn("Map size: %d", map.count); (void)io::printfn("Val: %d", map.get(1).x); io::printfn("Has 1: %s", map.has_key(1)); io::printfn("Has 2: %s", map.has_key(2)); - map.set(7, Foo { 4, null }); + map.set(7, { 4, null }); io::printfn("Values: %s", map.value_new_list()); IntDoubleMap map2; map2.new_init(); diff --git a/test/test_suite/stdlib/priorityqueue.c3t b/test/test_suite/stdlib/priorityqueue.c3t index e677e3ad6..f6dc6f93d 100644 --- a/test/test_suite/stdlib/priorityqueue.c3t +++ b/test/test_suite/stdlib/priorityqueue.c3t @@ -10,9 +10,9 @@ fn void main() { FooPriorityQueue agh; - agh.push(Foo { 3 }); - agh.push(Foo { 101 }); - agh.push(Foo { 10 }); + agh.push((Foo) { 3 }); + agh.push((Foo) { 101 }); + agh.push({ 10 }); while (try f = agh.pop()) io::printf("%s\n", f.x); } diff --git a/test/test_suite/struct/init_cont_struct_array_locally.c3t b/test/test_suite/struct/init_cont_struct_array_locally.c3t index cfc397bc3..b56588b26 100644 --- a/test/test_suite/struct/init_cont_struct_array_locally.c3t +++ b/test/test_suite/struct/init_cont_struct_array_locally.c3t @@ -6,11 +6,11 @@ struct Test char[2] id; } -Test t = Test{"id"}; +Test t = (Test){"id"}; fn int main() { io::printn(t); - Test y = Test { "id" }; + Test y = (Test) { "id" }; io::printn(); return 0; } diff --git a/test/test_suite/struct/nested_struct_union_init.c3t b/test/test_suite/struct/nested_struct_union_init.c3t index a56616fe1..5be6af01b 100644 --- a/test/test_suite/struct/nested_struct_union_init.c3t +++ b/test/test_suite/struct/nested_struct_union_init.c3t @@ -6,7 +6,8 @@ struct Matrix2x2 union { float[4] m; - struct { + struct + { float m00, m01, m10, m11; } } @@ -16,15 +17,19 @@ struct Matrix2x2_b { union { - struct { + struct + { float m00, m01, m10, m11; } float[4] m; } } -struct Matrix4x4 { - union { - struct { +struct Matrix4x4 +{ + union + { + struct + { float m00, m01, m02, m03; float m10, m11, m12, m13; float m20, m21, m22, m23; @@ -35,9 +40,12 @@ struct Matrix4x4 { } -struct Matrix3x3 { - union { - struct { +struct Matrix3x3 +{ + union + { + struct + { float m00, m01, m02, m10, m11, m12, m20, m21, m22; } float[9] m; @@ -46,7 +54,7 @@ struct Matrix3x3 { fn void main() { Matrix3x3 x = { 1, 2, 3, 4, 5, 6, 7,8 ,9}; - Matrix2x2 m = { float[4] { 1, 2, 3, 4 } }; + Matrix2x2 m = { (float[4]) { 1, 2, 3, 4 } }; Matrix2x2_b m2 = { 1, 2, 3, 4 }; libc::printf("%f %f %f %f\n", x.m00, x.m[1], x.m10, x.m[3]); } diff --git a/test/test_suite/struct/struct_reinit.c3t b/test/test_suite/struct/struct_reinit.c3t index 1f9ccde30..656a88118 100644 --- a/test/test_suite/struct/struct_reinit.c3t +++ b/test/test_suite/struct/struct_reinit.c3t @@ -15,7 +15,7 @@ fn void main() { Abc x = { 1, 4}; print(&x) @noinline; - x = Abc { x.b, x.a }; + x = (Abc) { x.b, x.a }; print(&x) @noinline; } diff --git a/test/test_suite/switch/switch_in_defer_macro.c3t b/test/test_suite/switch/switch_in_defer_macro.c3t index 2c6ccf638..0df7989b8 100644 --- a/test/test_suite/switch/switch_in_defer_macro.c3t +++ b/test/test_suite/switch/switch_in_defer_macro.c3t @@ -2,8 +2,8 @@ <* @require Token.kindof == ENUM && $typefrom(Token.inner).kindof == UNSIGNED_INT - @require $defined(Token{}.token) - @require $defined(Comment{}.start) && $defined(Comment{}.end) + @require $defined((Token){}.token) + @require $defined((Comment){}.start) && $defined((Comment){}.end) *> module lexer(); import std::io; @@ -493,7 +493,7 @@ fn void Trie.init(&self, usz initial_capacity = 8, Allocator using = allocator:: { *self = {}; self.nodes.new_init(initial_capacity, allocator: using); - self.nodes.push(TrieNode{}); + self.nodes.push((TrieNode){}); } <* @@ -585,7 +585,7 @@ fn void! TrieNode.set(&self, Trie *t, char[] key, Value value) @private if (new_idx > Index.max) return TrieError.TRIE_FULL?; idx = (Index)new_idx; self.children[c] = idx; - t.nodes.push(TrieNode{}); + t.nodes.push((TrieNode){}); } t.nodes[idx].set(t, key[1..], value)!; } diff --git a/test/test_suite/types/enum_parse_errors.c3 b/test/test_suite/types/enum_parse_errors.c3 index 09b5c5355..2284bfd6c 100644 --- a/test/test_suite/types/enum_parse_errors.c3 +++ b/test/test_suite/types/enum_parse_errors.c3 @@ -5,7 +5,7 @@ enum EnumWithErrorWithMissingName : (int) // #error: Expected a member name her } enum EnumWithErrorData : ( int -{ // #error: Expected a member name here +,{ // #error: Expected a member name here TEST } diff --git a/test/test_suite/vector/gather_scatter.c3t b/test/test_suite/vector/gather_scatter.c3t index 6093ff84e..f4868ae16 100644 --- a/test/test_suite/vector/gather_scatter.c3t +++ b/test/test_suite/vector/gather_scatter.c3t @@ -6,14 +6,14 @@ fn void main() int[5] a = { 1, 2, 3, 4, 5 }; void*[<2>] x = { &a[0], &a[4] }; int*[<2>] y = x; - int[<2>] result = mem::@gather_aligned(y, bool[<2>] { true, false }, int[<2>]{ 10, 20 }, 4); + int[<2>] result = mem::@gather_aligned(y, (bool[<2>]) { true, false }, (int[<2>]){ 10, 20 }, 4); assert(result == { 1, 20}); - result = mem::gather(y, bool[<2>] { true, false }, int[<2>]{ 10, 20 }); + result = mem::gather(y, (bool[<2>]) { true, false }, (int[<2>]){ 10, 20 }); assert(result == { 1, 20}); - mem::@scatter_aligned(y, int[<2>]{ 66, 77 }, bool[<2>] { false, true } , 4); - assert(a == int[5]{ 1, 2, 3, 4, 77}); - mem::scatter(y, int[<2>]{ 88, 99 }, bool[<2>] { true, false }); - assert(a == int[5]{ 88, 2, 3, 4, 77}); + mem::@scatter_aligned(y, (int[<2>]){ 66, 77 }, (bool[<2>]) { false, true } , 4); + assert(a == (int[5]){ 1, 2, 3, 4, 77}); + mem::scatter(y, (int[<2>]){ 88, 99 }, (bool[<2>]) { true, false }); + assert(a == (int[5]){ 88, 2, 3, 4, 77}); } /* #expect: foo.ll diff --git a/test/test_suite/vector/vector_consts.c3t b/test/test_suite/vector/vector_consts.c3t index 2f380b6e3..1a2c76710 100644 --- a/test/test_suite/vector/vector_consts.c3t +++ b/test/test_suite/vector/vector_consts.c3t @@ -4,7 +4,7 @@ import std::math; fn int x(char[<8>] a, char[<8>] b) { bool[<8>] z = a.comp_eq(b); - return (char[<8>] { [0..7] = 255 } & (char[<8>])z + ~(char[<8>])z & char[<8>] { 0, 1, 2, 3, 4, 5, 6, 7 }).min(); + return ((char[<8>]) { [0..7] = 255 } & (char[<8>])z + ~(char[<8>])z & (char[<8>]) { 0, 1, 2, 3, 4, 5, 6, 7 }).min(); } /* #expect: foo.ll diff --git a/test/test_suite/vector/vector_from_i1.c3t b/test/test_suite/vector/vector_from_i1.c3t index 7b9e18598..5741e166f 100644 --- a/test/test_suite/vector/vector_from_i1.c3t +++ b/test/test_suite/vector/vector_from_i1.c3t @@ -5,7 +5,7 @@ import std; // issue 1954 macro splat($Type, x) { - return $Type {x,x,x,x}; + return ($Type) {x,x,x,x}; } fn void main() diff --git a/test/test_suite/vector/vector_to_array_cast.c3t b/test/test_suite/vector/vector_to_array_cast.c3t index ce6044389..65218e8cd 100644 --- a/test/test_suite/vector/vector_to_array_cast.c3t +++ b/test/test_suite/vector/vector_to_array_cast.c3t @@ -2,8 +2,8 @@ module test; -int[<2>] b = (int[<2>])(int[2] { 1, 2 }); -int[2] c = (int[2])(int[<2>] { 1, 2 }); +int[<2>] b = (int[<2>])((int[2]) { 1, 2 }); +int[2] c = (int[2])((int[<2>]) { 1, 2 }); fn void tester() { diff --git a/test/unit/regression/bitstruct_ops.c3 b/test/unit/regression/bitstruct_ops.c3 index 2ff771b19..d74c853e2 100644 --- a/test/unit/regression/bitstruct_ops.c3 +++ b/test/unit/regression/bitstruct_ops.c3 @@ -25,7 +25,7 @@ fn void test_bitops() @test Foo f4 = (f1 | ~f2) ^ f3; assert(f4.a == false && f4.b == true); - Foo f5 = Foo { true, false } | Foo { false, true }; + Foo f5 = (Foo) { true, false } | (Foo) { false, true }; assert(f5.a == true && f5.b == true); f5 &= f2; @@ -38,7 +38,7 @@ fn void test_bitops() @test assert(b3.z == true && b3.w == false && b3.gh == false); b3 = ~b3; assert(b3.z == false && b3.w == true && b3.gh == true); - b3 ^= Bar { true, true, false }; + b3 ^= (Bar) { true, true, false }; assert(b3.z == true && b3.w == false && b3.gh == true); } diff --git a/test/unit/regression/bitstruct_ops2.c3 b/test/unit/regression/bitstruct_ops2.c3 index 02de12515..a2a374a3a 100644 --- a/test/unit/regression/bitstruct_ops2.c3 +++ b/test/unit/regression/bitstruct_ops2.c3 @@ -25,7 +25,7 @@ fn void test_bitops() @test Foo f4 = (f1 | ~f2) ^ f3; assert(f4.a == false && f4.b == true); - Foo f5 = Foo { true, false } | Foo { false, true }; + Foo f5 = (Foo) { true, false } | (Foo) { false, true }; assert(f5.a == true && f5.b == true); f5 &= f2; @@ -38,7 +38,7 @@ fn void test_bitops() @test assert(b3.z == true && b3.w == false && b3.gh == false); b3 = ~b3; assert(b3.z == false && b3.w == true && b3.gh == true); - b3 ^= Bar { true, true, false }; + b3 ^= (Bar) { true, true, false }; assert(b3.z == true && b3.w == false && b3.gh == true); } @@ -53,7 +53,7 @@ fn void test_bitops_const() @test const Foo F4 = (F1 | ~F2) ^ F3; assert(F4.a == false && F4.b == true); - const Foo F5 = Foo { true, false } | Foo { false, true }; + const Foo F5 = (Foo) { true, false } | (Foo) { false, true }; assert(F5.a == true && F5.b == true); const Bar B1 = { true, true, true }; diff --git a/test/unit/regression/bitstruct_ops3.c3 b/test/unit/regression/bitstruct_ops3.c3 index f0c2d96e1..ce58e9e8d 100644 --- a/test/unit/regression/bitstruct_ops3.c3 +++ b/test/unit/regression/bitstruct_ops3.c3 @@ -82,7 +82,7 @@ fn void negate() Flags flags; flags = ~flags; assert(~0 == (int)flags); - flags = ~Flags {}; + flags = ~(Flags){}; assert(3 == (int)flags); const Flags FLAGS = {.flag1 }; flags = ~FLAGS; diff --git a/test/unit/regression/cast_slice_to_arr.c3 b/test/unit/regression/cast_slice_to_arr.c3 index f1121b5e3..9e6638a71 100644 --- a/test/unit/regression/cast_slice_to_arr.c3 +++ b/test/unit/regression/cast_slice_to_arr.c3 @@ -5,7 +5,7 @@ fn void to_arr() int[] x = { 1, 2, 3, 4, 5 }; int z = 2; int[2] y = x[z:2]; - assert(y == int[2]{ 3, 4 }); + assert(y == {3, 4}); } fn void to_vec() diff --git a/test/unit/regression/ct_slice.c3 b/test/unit/regression/ct_slice.c3 index 6dac14b2f..3c38badbc 100644 --- a/test/unit/regression/ct_slice.c3 +++ b/test/unit/regression/ct_slice.c3 @@ -5,8 +5,8 @@ fn void slice_bytes() char[4] $a = x'aabbccdd'; var $b = $a[1..2]; char[2] y = $b; - assert($b == char[] { 187, 204 }); - assert(y == char[2] { 187, 204 }); + assert($b == (char[]){187, 204}); + assert(y == {187, 204 }); } fn void slice_string() @@ -28,11 +28,11 @@ fn void slice_untyped() { var $v = { 1, "hello", 3 }; int[1] v = $v[0:1]; - assert(v == int[1] { 1 }); + assert(v == { 1 }); int[1] v2 = $v[2:1]; - assert(v2 == int[1] { 3 }); + assert(v2 == { 3 }); String[1] v3 = $v[1:1]; - assert(v3 == String[1] { "hello" }); + assert(v3 == { "hello" }); int[] v4 = $v[0:1]; - assert(v4 == int[] { 1 }); + assert(v4 == { 1 }); } diff --git a/test/unit/regression/faults.c3 b/test/unit/regression/faults.c3 index 58bf33f3a..e4201162f 100644 --- a/test/unit/regression/faults.c3 +++ b/test/unit/regression/faults.c3 @@ -12,7 +12,7 @@ fn void ordinals() assert(z.ordinal == 0); $assert Foo.ABC.ordinal == 1; $assert Foo.CDE.ordinal == 2; - $assert (Foo{}).ordinal == 0; + $assert (Foo){}.ordinal == 0; Foo x = Foo.CDE; assert(x.ordinal == 2); x = Foo.ABC; diff --git a/test/unit/regression/gather_scatter.c3 b/test/unit/regression/gather_scatter.c3 index ef69e4582..763a2650b 100644 --- a/test/unit/regression/gather_scatter.c3 +++ b/test/unit/regression/gather_scatter.c3 @@ -5,12 +5,12 @@ fn void test_simple() @test int[5] a = { 1, 2, 3, 4, 5 }; void*[<2>] x = { &a[0], &a[4] }; int*[<2>] y = x; - int[<2>] result = mem::@gather_aligned(y, bool[<2>] { true, false }, int[<2>]{ 10, 20 }, 4); + int[<2>] result = mem::@gather_aligned(y, (bool[<2>]) { true, false }, (int[<2>]){ 10, 20 }, 4); assert(result == { 1, 20}); - result = mem::gather(y, bool[<2>] { true, false }, int[<2>]{ 10, 20 }); + result = mem::gather(y, (bool[<2>]) { true, false }, (int[<2>]){ 10, 20 }); assert(result == { 1, 20}); - mem::@scatter_aligned(y, int[<2>]{ 66, 77 }, bool[<2>] { false, true } , 4); - assert(a == int[5]{ 1, 2, 3, 4, 77}); - mem::scatter(y, int[<2>]{ 88, 99 }, bool[<2>] { true, false }); - assert(a == int[5]{ 88, 2, 3, 4, 77}); + mem::@scatter_aligned(y, (int[<2>]){ 66, 77 }, (bool[<2>]) { false, true } , 4); + assert(a == (int[5]){ 1, 2, 3, 4, 77}); + mem::scatter(y, (int[<2>]){ 88, 99 }, (bool[<2>]) { true, false }); + assert(a == (int[5]){ 88, 2, 3, 4, 77}); } diff --git a/test/unit/regression/masked_load_store.c3 b/test/unit/regression/masked_load_store.c3 index 079dff7ab..3ae822d50 100644 --- a/test/unit/regression/masked_load_store.c3 +++ b/test/unit/regression/masked_load_store.c3 @@ -2,27 +2,27 @@ import std; fn void masked_load() @test { long[<4>] val = { 1, 3, 5, 8 }; - long[<4>] res = mem::masked_load(&val, { true, false, true, false }, long[<4>] { 100, 200, 300, 400 }); + long[<4>] res = mem::masked_load(&val, { true, false, true, false }, (long[<4>]){ 100, 200, 300, 400 }); assert(res == { 1, 200, 5, 400 }); } fn void masked_load_aligned() @test { long[<4>] val = { 1, 3, 5, 8 }; - long[<4>] res = mem::@masked_load_aligned(&val, { true, false, true, false }, long[<4>] { 100, 200, 300, 400 }, 8); + long[<4>] res = mem::@masked_load_aligned(&val, { true, false, true, false }, (long[<4>]) { 100, 200, 300, 400 }, 8); assert(res == { 1, 200, 5, 400 }); } fn void masked_store() @test { long[<4>] val = { 1, 3, 5, 8 }; - mem::masked_store(&val, long[<4>] { 11, 22, 33, 44 }, { true, false, false, true }); + mem::masked_store(&val, (long[<4>]){11, 22, 33, 44}, { true, false, false, true }); assert(val == { 11, 3, 5, 44 }); } fn void masked_store_aligned() @test { long[<4>] val = { 1, 3, 5, 8 }; - mem::@masked_store_aligned(&val, long[<4>] { 11, 22, 33, 44 }, { true, false, false, true }, 8); + mem::@masked_store_aligned(&val, (long[<4>]){11, 22, 33, 44}, { true, false, false, true }, 8); assert(val == { 11, 3, 5, 44 }); } diff --git a/test/unit/regression/slice_assign.c3 b/test/unit/regression/slice_assign.c3 index 2ee1a12a8..f07970f5a 100644 --- a/test/unit/regression/slice_assign.c3 +++ b/test/unit/regression/slice_assign.c3 @@ -5,5 +5,5 @@ fn void assign_slice() int[8] a; a[2..3] = { 1, 2 }; a[5..7] = 5; - assert(a == int[8]{ 0, 0, 1, 2, 0, 5, 5, 5}); + assert(a == (int[8]){ 0, 0, 1, 2, 0, 5, 5, 5}); } \ No newline at end of file diff --git a/test/unit/regression/swizzle.c3 b/test/unit/regression/swizzle.c3 index 4df8629ca..f1c088c48 100644 --- a/test/unit/regression/swizzle.c3 +++ b/test/unit/regression/swizzle.c3 @@ -4,8 +4,8 @@ fn void test_swizzle() { int[<4>] a = { 1, 2, 3, 4 }; int[<4>] b = { 100, 1000, 10000, 100000 }; - assert($$swizzle(a, 0, 1, 1, 3) == int[<4>] { 1, 2, 2, 4 }); - assert($$swizzle2(a, b, 0, 1, 4, 6, 2) == int[<5>] { 1, 2, 100, 10000, 3 }); + assert($$swizzle(a, 0, 1, 1, 3) == (int[<4>]) { 1, 2, 2, 4 }); + assert($$swizzle2(a, b, 0, 1, 4, 6, 2) == (int[<5>]) { 1, 2, 100, 10000, 3 }); } fn void swizzle_builtin() diff --git a/test/unit/regression/vecpointer.c3 b/test/unit/regression/vecpointer.c3 index 22ef96cd2..1499dd525 100644 --- a/test/unit/regression/vecpointer.c3 +++ b/test/unit/regression/vecpointer.c3 @@ -30,6 +30,6 @@ fn void pointer_add_sub_diff() assert(w == { -1, 2 }); int*[<2>] zz = y - (y - yy); assert(zz[0] == &a[1] && zz[1] == &a[2]); - int[?]*[<2>] g = int[2]*[<2>] { null, null }; - int[?]*[] g2 = int[2]*[<2>] { null, null }; + int[?]*[<2>] g = (int[2]*[<2>]) { null, null }; + int[?]*[] g2 = (int[2]*[<2>]) { null, null }; } \ No newline at end of file diff --git a/test/unit/regression/vector_conversion.c3 b/test/unit/regression/vector_conversion.c3 index d12565112..5f9589b0e 100644 --- a/test/unit/regression/vector_conversion.c3 +++ b/test/unit/regression/vector_conversion.c3 @@ -9,11 +9,11 @@ fn void vector_array_inferred() int[] z = x; int[] w = y; double[<2>] ww = x; - assert((int[<2>])y == int[<2>]{ 4, 7}); - assert((int[<2>])y1 == int[<2>] { 4, 7 }); - assert((int[<2>])y2 == int[<2>] { 4, 7 }); - assert(z == int[<2>] { 4, 7 }); - assert(w == int[<2>] { 4, 7 }); + assert((int[<2>])y == { 4, 7}); + assert((int[<2>])y1 == { 4, 7 }); + assert((int[<2>])y2 == { 4, 7 }); + assert(z == { 4, 7 }); + assert(w == { 4, 7 }); } fn void vector_convert_slice() @@ -26,6 +26,6 @@ fn void vector_convert_slice() fn void vector_convert_bool() { bool[<2>] a = { true, false }; - assert(int[<2>] { -1, 0 } == (int[<2>])a); - assert(float[<2>] { 1.0, 0 } == (float[<2>])a); + assert({ -1, 0 } == (int[<2>])a); + assert({ 1.0, 0 } == (float[<2>])a); } \ No newline at end of file diff --git a/test/unit/regression/vector_ops.c3 b/test/unit/regression/vector_ops.c3 index 715d035ff..59aa1133f 100644 --- a/test/unit/regression/vector_ops.c3 +++ b/test/unit/regression/vector_ops.c3 @@ -6,8 +6,8 @@ fn void test_int_mod() @test int[<2>] z = { 3, 5 }; assert(y % z == { 1, 4 }); assert(y / z == { 3, 19 }); - assert(int[<2>]{ 10, 99 } % int[<2>]{ 3, 5 } == { 1, 4 }); - assert(int[<2>]{ 10, 99 } / int[<2>]{ 3, 5 } == { 3, 19 }); + assert((int[<2>]){ 10, 99 } % { 3, 5 } == { 1, 4 }); + assert((int[<2>]){ 10, 99 } / { 3, 5 } == { 3, 19 }); } fn void test_conv() @test @@ -26,7 +26,7 @@ fn void test_conv() @test bool[<2>] b = { true, false }; int[<2>] gh = b; assert(gh == { -1, 0 }); - var $k = bool[<2>] { true, false }; + var $k = (bool[<2>]){ true, false }; var $gh = (int[<2>])$k; $assert $gh[0] == -1; var $gh2 = (char[<2>])$gh; diff --git a/test/unit/stdlib/collections/bitset.c3 b/test/unit/stdlib/collections/bitset.c3 index 29a80cb9e..732c3fed6 100644 --- a/test/unit/stdlib/collections/bitset.c3 +++ b/test/unit/stdlib/collections/bitset.c3 @@ -37,7 +37,7 @@ fn void set_get() assert(!x); } } - assert(found.array_view() == usz[]{0, 2000}); + assert(found.array_view() == (usz[]){0, 2000}); bs.unset(0); assert(!bs.get(0)); @@ -81,7 +81,7 @@ fn void growable_set_get() assert(!x, "Should not get here"); } } - assert(found.array_view() == usz[]{0, 2000}, "Array view should hold 2"); + assert(found.array_view() == (usz[]){0, 2000}, "Array view should hold 2"); bs.unset(0); assert(!bs.get(0), "Get should be false"); diff --git a/test/unit/stdlib/collections/elastic_array.c3 b/test/unit/stdlib/collections/elastic_array.c3 index 10e64d2b9..998e56c3a 100644 --- a/test/unit/stdlib/collections/elastic_array.c3 +++ b/test/unit/stdlib/collections/elastic_array.c3 @@ -12,25 +12,25 @@ fn void delete_contains_index() assert(test.contains(2)); assert(!test.contains(0)); assert(!test.contains(3)); - assert(test.array_view() == int[]{ 1, 2 }); + assert(test.array_view() == (int[]){ 1, 2 }); test.push(3); - assert(test.array_view() == int[]{ 1, 2, 3 }); + assert(test.array_view() == (int[]){ 1, 2, 3 }); assert(test.contains(3)); test[0] = 10; assert(test.contains(10)); test.remove_item(10); - assert(test.array_view() == int[]{ 2, 3 }); + assert(test.array_view() == (int[]){ 2, 3 }); assert(!test.contains(1)); assert(test.contains(2)); assert(test.len() == 2); test.push(0); test.insert_at(0, 0); - assert(test.array_view() == int[]{ 0, 2, 3, 0 }); + assert(test.array_view() == (int[]){ 0, 2, 3, 0 }); assert(test.index_of(0)!! == 0); assert(test.rindex_of(0)!! == 3); test.remove_item(0); assert(test.len() == 2); - assert(test.array_view() == int[]{ 2, 3 }); + assert(test.array_view() == (int[]){ 2, 3 }); } fn void compact() @@ -52,13 +52,13 @@ fn void reverse() test.reverse(); test.add_array({ 1, 2 }); test.push(3); - assert(test.array_view() == int[] { 1, 2, 3}); + assert(test.array_view() == (int[]) { 1, 2, 3}); test.reverse(); - assert(test.array_view() == int[] { 3, 2, 1 }); + assert(test.array_view() == (int[]) { 3, 2, 1 }); test.push(10); - assert(test.array_view() == int[] { 3, 2, 1, 10 }); + assert(test.array_view() == (int[]) { 3, 2, 1, 10 }); test.reverse(); - assert(test.array_view() == int[] { 10, 1, 2, 3 }); + assert(test.array_view() == (int[]) { 10, 1, 2, 3 }); } fn void remove_if() @@ -69,13 +69,13 @@ fn void remove_if() test.add_array({ 1, 11, 2, 10, 20 }); removed = test.remove_if(&filter); assert(removed == 3); - assert(test.array_view() == int[]{1, 2}); + assert(test.array_view() == (int[]){1, 2}); test.clear(); test.add_array({ 1, 11, 2, 10, 20 }); removed = test.remove_if(&select); assert(removed == 2); - assert(test.array_view() == int[]{11, 10, 20}); + assert(test.array_view() == (int[]){11, 10, 20}); } @@ -87,13 +87,13 @@ fn void remove_using_test() test.add_array({ 1, 11, 2, 10, 20 }); removed = test.remove_using_test(fn bool(i, ctx) => *i >= *(int*)ctx, &&10); assert(removed == 3); - assert(test.array_view() == int[]{1, 2}); + assert(test.array_view() == (int[]){1, 2}); test.clear(); test.add_array({ 1, 11, 2, 10, 20 }); removed = test.remove_using_test(fn bool(i, ctx) => *i < *(int*)ctx, &&10); assert(removed == 2); - assert(test.array_view() == int[]{11, 10, 20}); + assert(test.array_view() == (int[]){11, 10, 20}); } fn void retain_if() @@ -104,13 +104,13 @@ fn void retain_if() test.add_array({ 1, 11, 2, 10, 20 }); removed = test.retain_if(&select); assert(removed == 3); - assert(test.array_view() == int[]{1, 2}); + assert(test.array_view() == (int[]){1, 2}); test.clear(); test.add_array({ 1, 11, 2, 10, 20 }); removed = test.retain_if(&filter); assert(removed == 2); - assert(test.array_view() == int[]{11, 10, 20}); + assert(test.array_view() == (int[]){11, 10, 20}); } fn void retain_using_test() @@ -121,13 +121,13 @@ fn void retain_using_test() test.add_array({ 1, 11, 2, 10, 20 }); removed = test.remove_using_test(fn bool(i, ctx) => *i >= *(int*)ctx, &&10); assert(removed == 3); - assert(test.array_view() == int[]{1, 2}); + assert(test.array_view() == (int[]){1, 2}); test.clear(); test.add_array({ 1, 11, 2, 10, 20 }); removed = test.remove_using_test(fn bool(i, ctx) => *i < *(int*)ctx, &&10); assert(removed == 2); - assert(test.array_view() == int[]{11, 10, 20}); + assert(test.array_view() == (int[]){11, 10, 20}); } module elastic_array_test; diff --git a/test/unit/stdlib/collections/list.c3 b/test/unit/stdlib/collections/list.c3 index 6a31585e1..6d7b0e11c 100644 --- a/test/unit/stdlib/collections/list.c3 +++ b/test/unit/stdlib/collections/list.c3 @@ -31,25 +31,25 @@ fn void delete_contains_index() assert(test.contains(2)); assert(!test.contains(0)); assert(!test.contains(3)); - assert(test.array_view() == int[]{ 1, 2 }); + assert(test.array_view() == { 1, 2 }); test.push(3); - assert(test.array_view() == int[]{ 1, 2, 3 }); + assert(test.array_view() == { 1, 2, 3 }); assert(test.contains(3)); test[0] = 10; assert(test.contains(10)); test.remove_item(10); - assert(test.array_view() == int[]{ 2, 3 }); + assert(test.array_view() == { 2, 3 }); assert(!test.contains(1)); assert(test.contains(2)); assert(test.len() == 2); test.push(0); test.insert_at(0, 0); - assert(test.array_view() == int[]{ 0, 2, 3, 0 }); + assert(test.array_view() == { 0, 2, 3, 0 }); assert(test.index_of(0)!! == 0); assert(test.rindex_of(0)!! == 3); test.remove_item(0); assert(test.len() == 2); - assert(test.array_view() == int[]{ 2, 3 }); + assert(test.array_view() == { 2, 3 }); } fn void compact() @@ -74,13 +74,13 @@ fn void reverse() test.reverse(); test.add_array({ 1, 2 }); test.push(3); - assert(test.array_view() == int[] { 1, 2, 3}); + assert(test.array_view() == { 1, 2, 3}); test.reverse(); - assert(test.array_view() == int[] { 3, 2, 1 }); + assert(test.array_view() == { 3, 2, 1 }); test.push(10); - assert(test.array_view() == int[] { 3, 2, 1, 10 }); + assert(test.array_view() == { 3, 2, 1, 10 }); test.reverse(); - assert(test.array_view() == int[] { 10, 1, 2, 3 }); + assert(test.array_view() == { 10, 1, 2, 3 }); } fn void remove_if() @@ -92,13 +92,13 @@ fn void remove_if() test.add_array({ 1, 11, 2, 10, 20 }); removed = test.remove_if(&filter); assert(removed == 3); - assert(test.array_view() == int[]{1, 2}); + assert(test.array_view() == {1, 2}); test.clear(); test.add_array({ 1, 11, 2, 10, 20 }); removed = test.remove_if(&select); assert(removed == 2); - assert(test.array_view() == int[]{11, 10, 20}); + assert(test.array_view() == {11, 10, 20}); } fn void init_with_array() @@ -127,13 +127,13 @@ fn void remove_using_test() test.add_array({ 1, 11, 2, 10, 20 }); removed = test.remove_using_test(fn bool(i, ctx) => *i >= *(int*)ctx, &&10); assert(removed == 3); - assert(test.array_view() == int[]{1, 2}); + assert(test.array_view() == {1, 2}); test.clear(); test.add_array({ 1, 11, 2, 10, 20 }); removed = test.remove_using_test(fn bool(i, ctx) => *i < *(int*)ctx, &&10); assert(removed == 2); - assert(test.array_view() == int[]{11, 10, 20}); + assert(test.array_view() == {11, 10, 20}); } fn void retain_if() @@ -145,13 +145,13 @@ fn void retain_if() test.add_array({ 1, 11, 2, 10, 20 }); removed = test.retain_if(&select); assert(removed == 3); - assert(test.array_view() == int[]{1, 2}); + assert(test.array_view() == {1, 2}); test.clear(); test.add_array({ 1, 11, 2, 10, 20 }); removed = test.retain_if(&filter); assert(removed == 2); - assert(test.array_view() == int[]{11, 10, 20}); + assert(test.array_view() == {11, 10, 20}); } fn void retain_using_test() @@ -163,13 +163,13 @@ fn void retain_using_test() test.add_array({ 1, 11, 2, 10, 20 }); removed = test.remove_using_test(fn bool(i, ctx) => *i >= *(int*)ctx, &&10); assert(removed == 3); - assert(test.array_view() == int[]{1, 2}); + assert(test.array_view() == {1, 2}); test.clear(); test.add_array({ 1, 11, 2, 10, 20 }); removed = test.remove_using_test(fn bool(i, ctx) => *i < *(int*)ctx, &&10); assert(removed == 2); - assert(test.array_view() == int[]{11, 10, 20}); + assert(test.array_view() == {11, 10, 20}); } module list_test; diff --git a/test/unit/stdlib/core/array.c3 b/test/unit/stdlib/core/array.c3 index e356bed5b..b5c3502cc 100644 --- a/test/unit/stdlib/core/array.c3 +++ b/test/unit/stdlib/core/array.c3 @@ -24,9 +24,9 @@ fn void concat() free(array::concat_new(a, a)); free(array::concat_new(a[..], a[..])); free(array::concat_new(a[:0], a[:0])); - free(array::concat_new(int[2] { 1, 2 }, a[:0])); - free(array::concat_new(a[:0], int[2] { 1, 2 })); + free(array::concat_new((int[2]) { 1, 2 }, a[:0])); + free(array::concat_new(a[:0], (int[2]) { 1, 2 })); int[] c = array::concat_new(a[1..2], a); defer free(c); - assert (c == int[]{ 2, 3, 1, 2, 3 }); + assert (c == (int[]){ 2, 3, 1, 2, 3 }); } diff --git a/test/unit/stdlib/core/builtintests.c3 b/test/unit/stdlib/core/builtintests.c3 index 16a783f23..17f1847f2 100644 --- a/test/unit/stdlib/core/builtintests.c3 +++ b/test/unit/stdlib/core/builtintests.c3 @@ -62,16 +62,16 @@ fn void test_prefetch() fn void test_hash() { - char{}.hash(); - ichar{}.hash(); - short{}.hash(); - ushort{}.hash(); - int{}.hash(); - uint{}.hash(); - long{}.hash(); - ulong{}.hash(); - int128{}.hash(); - uint128{}.hash(); + (char){}.hash(); + (ichar){}.hash(); + (short){}.hash(); + (ushort){}.hash(); + (int){}.hash(); + (uint){}.hash(); + (long){}.hash(); + (ulong){}.hash(); + (int128){}.hash(); + (uint128){}.hash(); String x = "abc"; char[] y = "abc"; assert(x.hash() == y.hash()); diff --git a/test/unit/stdlib/core/formatter.c3 b/test/unit/stdlib/core/formatter.c3 index 625910603..2812cee67 100644 --- a/test/unit/stdlib/core/formatter.c3 +++ b/test/unit/stdlib/core/formatter.c3 @@ -10,7 +10,7 @@ fn usz! Foo.to_format(&self, Formatter *f) @dynamic fn void test_ref() @test { - Foo* f = &&Foo{ 8 }; + Foo* f = &&(Foo){ 8 }; Foo* f0 = null; int* a = (void*)(uptr)0x40; int* b = null; diff --git a/test/unit/stdlib/encoding/csv.c3 b/test/unit/stdlib/encoding/csv.c3 index 413ba19fc..2e8d13b07 100644 --- a/test/unit/stdlib/encoding/csv.c3 +++ b/test/unit/stdlib/encoding/csv.c3 @@ -36,7 +36,7 @@ fn void csv_each_row() String[] want = t.want; CsvReader r; - r.init(ByteReader{}.init(t.input), t.sep); + r.init((ByteReader){}.init(t.input), t.sep); r.@each_row(; String[] row) { foreach (i, s : row) { assert(want.len > 0, @@ -58,7 +58,7 @@ fn void csv_row() "," }; CsvReader r; - r.init(ByteReader{}.init(t.input), t.sep); + r.init((ByteReader){}.init(t.input), t.sep); CsvRow row = r.read_temp_row()!!; assert(row.list.len == t.want.len, "not enough records found"); for (int i = 0; i < row.list.len; i++) { diff --git a/test/unit/stdlib/io/multiwriter.c3 b/test/unit/stdlib/io/multiwriter.c3 index 48571db8d..8261bab34 100644 --- a/test/unit/stdlib/io/multiwriter.c3 +++ b/test/unit/stdlib/io/multiwriter.c3 @@ -8,7 +8,7 @@ fn void test_multiwriter() defer mw.free(); String want = "foobar"; - io::copy_to(ByteReader{}.init(want), &mw)!!; + io::copy_to((ByteReader){}.init(want), &mw)!!; assert(w1.str_view() == want, "invalid write; got: %s, want: %s", w1.str_view(), want); diff --git a/test/unit/stdlib/io/teereader.c3 b/test/unit/stdlib/io/teereader.c3 index baff3c132..c76181f5f 100644 --- a/test/unit/stdlib/io/teereader.c3 +++ b/test/unit/stdlib/io/teereader.c3 @@ -5,7 +5,7 @@ fn void test_teereader() String want = "foobar"; ByteWriter w; - TeeReader r = tee_reader(ByteReader{}.init(want), w.temp_init()); + TeeReader r = tee_reader((ByteReader){}.init(want), w.temp_init()); char[16] buf; usz n = r.read(buf[..])!!; diff --git a/test/unit/stdlib/math/math.c3 b/test/unit/stdlib/math/math.c3 index 45c9ab369..3e1a7f1fd 100644 --- a/test/unit/stdlib/math/math.c3 +++ b/test/unit/stdlib/math/math.c3 @@ -11,9 +11,9 @@ fn void test_abs() @test assert(math::abs(z) == 21.0f); $assert @typeis(math::abs(z), float); int[<3>] xx = { -1, -1000, 1000 }; - assert(math::abs(xx) == int[<3>] { 1, 1000, 1000 }); + assert(math::abs(xx) == (int[<3>]) { 1, 1000, 1000 }); double[<3>] yy = { -1, -0.5, 1000 }; - assert(math::abs(yy) == double[<3>] { 1, 0.5, 1000 }); + assert(math::abs(yy) == (double[<3>]) { 1, 0.5, 1000 }); } fn void test_acos() @test @@ -269,7 +269,7 @@ fn void test_ceil() @test assert(math::ceil(f) == 0.0f); $assert @typeis(math::ceil(f), float); double[<5>] vec = { -123.1, 123.1, 0.1, -0.9, 0 }; - assert(math::ceil(vec) == double[<5>] { -123, 124, 1, 0, 0 }); + assert(math::ceil(vec) == (double[<5>]) { -123, 124, 1, 0, 0 }); } fn void test_cos() @test @@ -351,7 +351,7 @@ fn void test_floor() @test assert(math::floor(f) == -1.0f); $assert @typeis(math::floor(f), float); double[<5>] vec = { -123.1, 123.1, 0.9, -0.1, 0 }; - assert(math::floor(vec) == double[<5>] { -124, 123, 0, -1, 0 }); + assert(math::floor(vec) == (double[<5>]) { -124, 123, 0, -1, 0 }); } fn void test_log() @test @@ -536,7 +536,7 @@ fn void test_trunc() @test assert(math::trunc(f) == -0.0f); $assert @typeis(math::trunc(f), float); double[<5>] vec = { -123.9, 123.9, 0.9, -0.9, 0 }; - assert(math::trunc(vec) == double[<5>] { -123, 123, 0, 0, 0 }); + assert(math::trunc(vec) == (double[<5>]) { -123, 123, 0, 0, 0 }); } fn void test_round_decimals() @test @@ -579,14 +579,14 @@ fn void test_muldiv() assert(h.muldiv(2_000_000_000_000u64, 1_000_000_000u64) == 2_000_000_000_000_000u64); char[<4>] i = {20, 30, 40, 50}; - assert(i.muldiv(12,10) == char[<4>] {24, 36, 48, 60}); - assert(i.muldiv(char[<4>]{11, 12, 13, 14}, char[<4>]{10,10,10,10}) == char[<4>]{22, 36, 52, 70}); + assert(i.muldiv(12,10) == (char[<4>]) {24, 36, 48, 60}); + assert(i.muldiv((char[<4>]){11, 12, 13, 14}, (char[<4>]){10,10,10,10}) == (char[<4>]){22, 36, 52, 70}); long[<4>] j = {1_000_000_000_000i64, 2_000_000_000_000i64, 3_000_000_000_000i64, 4_000_000_000_000i64}; - assert(j.muldiv(2_000_000_000_000i64, 1_000_000_000i64) == long[<4>]{2_000_000_000_000_000i64, 4_000_000_000_000_000i64, 6_000_000_000_000_000i64, 8_000_000_000_000_000i64}); + assert(j.muldiv(2_000_000_000_000i64, 1_000_000_000i64) == (long[<4>]){2_000_000_000_000_000i64, 4_000_000_000_000_000i64, 6_000_000_000_000_000i64, 8_000_000_000_000_000i64}); ichar[<4>] k = {20, 30, 40, 50}; - assert(k.muldiv(20,-10) == ichar[<4>]{-40,-60,-80,-100}); + assert(k.muldiv(20,-10) == (ichar[<4>]){-40,-60,-80,-100}); } fn void test_gcd() @test diff --git a/test/unit/stdlib/math/math_complex.c3 b/test/unit/stdlib/math/math_complex.c3 index 9dc8b58e6..c8a023f71 100644 --- a/test/unit/stdlib/math/math_complex.c3 +++ b/test/unit/stdlib/math/math_complex.c3 @@ -12,36 +12,36 @@ def ComplexType = Complex(); fn void complex_mul_imaginary() { ComplexType i = complex::IMAGINARY(); - assert(i.mul(i).equals(ComplexType{-1, 0})); - assert(i.mul(i).mul(i).equals(ComplexType{0, -1})); + assert(i.mul(i).equals((ComplexType){-1, 0})); + assert(i.mul(i).mul(i).equals((ComplexType){0, -1})); } fn void complex_add() { ComplexType a = {3, 4}; ComplexType b = {1, 2}; - assert(a.add(b).equals(ComplexType{4, 6})); - assert(a.add_each(1).equals(ComplexType{4, 5})); + assert(a.add(b).equals((ComplexType){4, 6})); + assert(a.add_each(1).equals((ComplexType){4, 5})); } fn void complex_sub() { ComplexType a = {3, 4}; ComplexType b = {1, 2}; - assert(a.sub(b).equals(ComplexType{2, 2})); - assert(a.sub_each(1).equals(ComplexType{2, 3})); + assert(a.sub(b).equals((ComplexType){2, 2})); + assert(a.sub_each(1).equals((ComplexType){2, 3})); } fn void complex_scale() { ComplexType a = {2, 1}; - assert(a.scale(2).equals(ComplexType{4, 2})); + assert(a.scale(2).equals((ComplexType){4, 2})); } fn void complex_conjugate() { ComplexType a = {3, 4}; - assert(a.conjugate().equals(ComplexType{3, -4})); + assert(a.conjugate().equals((ComplexType){3, -4})); } fn void complex_inverse() @if(types::is_float(ElementType)) @@ -54,6 +54,6 @@ fn void complex_div() @if(types::is_float(ElementType)) { ComplexType a = {2, 5}; ComplexType b = {4, -1}; - assert(a.div(b).equals(ComplexType{3.0/17.0, 22.0/17.0})); + assert(a.div(b).equals((ComplexType){3.0/17.0, 22.0/17.0})); } diff --git a/test/unit/stdlib/math/matrix.c3 b/test/unit/stdlib/math/matrix.c3 index 3ed8f1e2a..4e40baa4c 100644 --- a/test/unit/stdlib/math/matrix.c3 +++ b/test/unit/stdlib/math/matrix.c3 @@ -9,7 +9,7 @@ fn void test_mat4() Matrix4 calc = mat.mul(mat2); assert(calc.m == mat.m); - Matrix4 translated = mat.translate(Vec3{0.0, 0.0, 0.0}); + Matrix4 translated = mat.translate({0.0, 0.0, 0.0}); assert(translated.m == mat.m); }; @@ -117,6 +117,6 @@ fn void test_mat2_inverse() fn void test_vec3() { - Vec3 cross = Vec3{2,3,4}.cross(Vec3{5,6,7}); - assert(cross == Vec3{-3,6,-3}); + Vec3 cross = (Vec3){2,3,4}.cross({5,6,7}); + assert(cross == {-3,6,-3}); } diff --git a/test/unit/stdlib/math/quaternion.c3 b/test/unit/stdlib/math/quaternion.c3 index 2e2c8dec0..2438b1de6 100644 --- a/test/unit/stdlib/math/quaternion.c3 +++ b/test/unit/stdlib/math/quaternion.c3 @@ -29,8 +29,8 @@ fn void test() 0.000000, 0.000000, 0.000000, 1.000000 }; - Matrix4 rotation = Quaternion {0.5, 0.5, 0.5, 1}.to_matrix(); - Matrix4f rotation_f = Quaternionf {0.5, 0.5, 0.5, 1}.to_matrixf(); + Matrix4 rotation = (Quaternion) {0.5, 0.5, 0.5, 1}.to_matrix(); + Matrix4f rotation_f = (Quaternionf) {0.5, 0.5, 0.5, 1}.to_matrixf(); assert(math::round_to_decimals((double[<16>])result.m, 2) == math::round_to_decimals((double[<16>])rotation.m, 2)); assert(math::round_to_decimals((float[<16>])result.m, 2) == math::round_to_decimals((float[<16>])rotation_f.m, 2)); diff --git a/test/unit/stdlib/net/url_encoding.c3 b/test/unit/stdlib/net/url_encoding.c3 index 83213e7bb..5c0883645 100644 --- a/test/unit/stdlib/net/url_encoding.c3 +++ b/test/unit/stdlib/net/url_encoding.c3 @@ -12,190 +12,66 @@ struct EncodeTest } EncodeTest[?] decode_with_error_tests @local = { - { - "", - "", - anyfault{}, - UrlEncodingMode.QUERY, - }, - { - "abc", - "abc", - anyfault{}, - UrlEncodingMode.QUERY, - }, - { - "1%41", - "1A", - anyfault{}, - UrlEncodingMode.QUERY, - }, - { - "1%41%42%43", - "1ABC", - anyfault{}, - UrlEncodingMode.QUERY, - }, - { - "%4a", - "J", - anyfault{}, - UrlEncodingMode.QUERY, - }, - { - "%6F", - "o", - anyfault{}, - UrlEncodingMode.QUERY, - }, - { - "%", - "", - UrlDecodingError.INVALID_HEX, - UrlEncodingMode.QUERY, - }, - { - "%a", - "", - UrlDecodingError.INVALID_HEX, - UrlEncodingMode.QUERY, - }, - { - "%1", - "", - UrlDecodingError.INVALID_HEX, - UrlEncodingMode.QUERY, - }, - { - "123%45%6", - "", - UrlDecodingError.INVALID_HEX, - UrlEncodingMode.QUERY, - }, - { - "%zzzzz", - "", - UrlDecodingError.INVALID_HEX, - UrlEncodingMode.QUERY, - }, - { - "a+b", - "a b", - anyfault{}, - UrlEncodingMode.QUERY, - }, - { - "a%20b", - "a b", - anyfault{}, - UrlEncodingMode.QUERY, - }, + { "", "", {}, QUERY, }, + { "abc", "abc", {}, QUERY, }, + { "1%41", "1A", {}, QUERY, }, + { "1%41%42%43", "1ABC", {}, QUERY, }, + { "%4a", "J", {}, QUERY, }, + { "%6F", "o", {}, QUERY, }, + { "%", "", UrlDecodingError.INVALID_HEX, QUERY, }, + { "%a", "", UrlDecodingError.INVALID_HEX, QUERY, }, + { "%1", "", UrlDecodingError.INVALID_HEX, QUERY, }, + { "123%45%6", "", UrlDecodingError.INVALID_HEX, QUERY, }, + { "%zzzzz", "", UrlDecodingError.INVALID_HEX, QUERY, }, + { "a+b", "a b", {}, QUERY, }, + { "a%20b", "a b", {}, QUERY, }, }; -fn void test_decoding_with_error() +fn void test_decoding_with_error() => @pool() { - String! actual; - @pool() { - foreach (test: decode_with_error_tests) + foreach (test: decode_with_error_tests) + { + String! actual = url::temp_decode(test.in, test.mode); + if (catch excuse = actual) { - actual = url::temp_decode(test.in, test.mode); - if (catch excuse = actual) - { - assert(excuse == test.err, "unescape(%s, %s); " + assert(excuse == test.err, "unescape(%s, %s); " "got: %s, want: %s", test.in, test.mode, excuse, test.err); - continue; - } - assert(actual == test.out, "unescape(%s, %s); " - "got: %s, want: %s", test.in, test.mode, actual, test.out); + continue; } - }; + assert(actual == test.out, "unescape(%s, %s); " + "got: %s, want: %s", test.in, test.mode, actual, test.out); + } } EncodeTest[?] encode_tests @local = { - { - "", - "", - anyfault{}, - UrlEncodingMode.PATH, + { "", "", {}, PATH, }, + { "abc", "abc", {}, PATH, }, + { "abc+def", "abc+def", {}, PATH, }, + { "a/b", "a/b", {}, PATH, }, + { "one two", "one%20two", {}, PATH, }, + { "10%", "10%25", {}, PATH, }, + { "", "", {}, QUERY, }, + { "abc", "abc", {}, QUERY, }, + { "one two", "one+two", {}, QUERY, }, + { "10%", "10%25", {}, QUERY, }, + { " ?&=#+%!<>#\"{}|\\^[]`☺\t:/@$'()*,;", + "+%3F%26%3D%23%2B%25%21%3C%3E%23%22%7B%7D%7C%5C%5E%5B%5D%60%E2%98%BA%09%3A%2F%40%24%27%28%29%2A%2C%3B", + {}, QUERY, }, - { - "abc", - "abc", - anyfault{}, - UrlEncodingMode.PATH, - }, - { - "abc+def", - "abc+def", - anyfault{}, - UrlEncodingMode.PATH, - }, - { - "a/b", - "a/b", - anyfault{}, - UrlEncodingMode.PATH, - }, - { - "one two", - "one%20two", - anyfault{}, - UrlEncodingMode.PATH, - }, - { - "10%", - "10%25", - anyfault{}, - UrlEncodingMode.PATH, - }, - { - "", - "", - anyfault{}, - UrlEncodingMode.QUERY, - }, - { - "abc", - "abc", - anyfault{}, - UrlEncodingMode.QUERY, - }, - { - "one two", - "one+two", - anyfault{}, - UrlEncodingMode.QUERY, - }, - { - "10%", - "10%25", - anyfault{}, - UrlEncodingMode.QUERY, - }, - { - " ?&=#+%!<>#\"{}|\\^[]`☺\t:/@$'()*,;", - "+%3F%26%3D%23%2B%25%21%3C%3E%23%22%7B%7D%7C%5C%5E%5B%5D%60%E2%98%BA%09%3A%2F%40%24%27%28%29%2A%2C%3B", - anyfault{}, - UrlEncodingMode.QUERY, - }, - }; -fn void test_percent_encode_and_decode() +fn void test_percent_encode_and_decode() => @pool() { - String actual; - @pool() { - foreach (test: encode_tests) - { - actual = url::temp_encode(test.in, test.mode); - assert(actual == test.out, "escape(%s, %s); " - "got: %s, want: %s", test.in, test.mode, actual, test.out); + foreach (test: encode_tests) + { + String actual = url::temp_encode(test.in, test.mode); + assert(actual == test.out, "escape(%s, %s); " + "got: %s, want: %s", test.in, test.mode, actual, test.out); - actual = url::temp_decode(test.out, test.mode)!!; - assert(actual == test.in, "unescape(%s, %s); " + actual = url::temp_decode(test.out, test.mode)!!; + assert(actual == test.in, "unescape(%s, %s); " "got: %s, want: %s", test.out, test.mode, actual, test.in); - } - }; + } } struct ShouldEncodeTest @@ -206,60 +82,59 @@ struct ShouldEncodeTest } ShouldEncodeTest[?] should_encode_tests = { - {'a', UrlEncodingMode.PATH, false}, - {'a', UrlEncodingMode.USERPASS, false}, - {'a', UrlEncodingMode.QUERY, false}, - {'a', UrlEncodingMode.FRAGMENT, false}, - {'a', UrlEncodingMode.HOST, false}, - {'z', UrlEncodingMode.PATH, false}, - {'A', UrlEncodingMode.PATH, false}, - {'Z', UrlEncodingMode.PATH, false}, - {'0', UrlEncodingMode.PATH, false}, - {'9', UrlEncodingMode.PATH, false}, - {'-', UrlEncodingMode.PATH, false}, - {'-', UrlEncodingMode.USERPASS, false}, - {'-', UrlEncodingMode.QUERY, false}, - {'-', UrlEncodingMode.FRAGMENT, false}, - {'.', UrlEncodingMode.PATH, false}, - {'_', UrlEncodingMode.PATH, false}, - {'~', UrlEncodingMode.PATH, false}, + {'a', PATH, false}, + {'a', USERPASS, false}, + {'a', QUERY, false}, + {'a', FRAGMENT, false}, + {'a', HOST, false}, + {'z', PATH, false}, + {'A', PATH, false}, + {'Z', PATH, false}, + {'0', PATH, false}, + {'9', PATH, false}, + {'-', PATH, false}, + {'-', USERPASS, false}, + {'-', QUERY, false}, + {'-', FRAGMENT, false}, + {'.', PATH, false}, + {'_', PATH, false}, + {'~', PATH, false}, - {'/', UrlEncodingMode.USERPASS, true}, - {'?', UrlEncodingMode.USERPASS, true}, - {'@', UrlEncodingMode.USERPASS, true}, - {'$', UrlEncodingMode.USERPASS, false}, - {'&', UrlEncodingMode.USERPASS, false}, - {'+', UrlEncodingMode.USERPASS, false}, - {',', UrlEncodingMode.USERPASS, false}, - {';', UrlEncodingMode.USERPASS, false}, - {'=', UrlEncodingMode.USERPASS, false}, + {'/', USERPASS, true}, + {'?', USERPASS, true}, + {'@', USERPASS, true}, + {'$', USERPASS, false}, + {'&', USERPASS, false}, + {'+', USERPASS, false}, + {',', USERPASS, false}, + {';', USERPASS, false}, + {'=', USERPASS, false}, - {'!', UrlEncodingMode.HOST, false}, - {'$', UrlEncodingMode.HOST, false}, - {'&', UrlEncodingMode.HOST, false}, - {'\'', UrlEncodingMode.HOST, false}, - {'(', UrlEncodingMode.HOST, false}, - {')', UrlEncodingMode.HOST, false}, - {'*', UrlEncodingMode.HOST, false}, - {'+', UrlEncodingMode.HOST, false}, - {',', UrlEncodingMode.HOST, false}, - {';', UrlEncodingMode.HOST, false}, - {'=', UrlEncodingMode.HOST, false}, - {'0', UrlEncodingMode.HOST, false}, - {'9', UrlEncodingMode.HOST, false}, - {'A', UrlEncodingMode.HOST, false}, - {'z', UrlEncodingMode.HOST, false}, - {'_', UrlEncodingMode.HOST, false}, - {'-', UrlEncodingMode.HOST, false}, - {'.', UrlEncodingMode.HOST, false}, + {'!', HOST, false}, + {'$', HOST, false}, + {'&', HOST, false}, + {'\'',HOST, false}, + {'(', HOST, false}, + {')', HOST, false}, + {'*', HOST, false}, + {'+', HOST, false}, + {',', HOST, false}, + {';', HOST, false}, + {'=', HOST, false}, + {'0', HOST, false}, + {'9', HOST, false}, + {'A', HOST, false}, + {'z', HOST, false}, + {'_', HOST, false}, + {'-', HOST, false}, + {'.', HOST, false}, }; fn void test_should_encode() { - bool actual; - foreach (test: should_encode_tests) + foreach (test : should_encode_tests) { - actual = url::should_encode(test.in, test.mode); + bool actual = url::should_encode(test.in, test.mode); assert(actual == test.escape, "should_encode(%c, %s); " "got: %s, want: %s", test.in, test.mode, actual, test.escape); }