From 63003d252721af56d311163afe937df771f15843 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Wed, 16 Aug 2023 22:00:07 +0300 Subject: array syntax --- tests/arr.ek | 2 +- tests/structs.ek | 30 +++++------------------------- 2 files changed, 6 insertions(+), 26 deletions(-) (limited to 'tests') diff --git a/tests/arr.ek b/tests/arr.ek index d4f35f7..8596fd0 100644 --- a/tests/arr.ek +++ b/tests/arr.ek @@ -1,5 +1,5 @@ main() { - a '[20]'[20]'type![u32, u32]; + a '[20]'[20]'type![u32, u32] = [20, => 20 ... 200 = 240, [200, 200]]; a[20] = 200; } diff --git a/tests/structs.ek b/tests/structs.ek index ed0b30f..20d9c48 100644 --- a/tests/structs.ek +++ b/tests/structs.ek @@ -15,34 +15,14 @@ struct complex_struct (A any, B any, C any) { main() { /* infer types */ - simple_named const = !{.a = 1, .b = 2, .c = 3} as basic_struct; - simple_ordinal const = !{1, 2, 3} as basic_struct; - simple_mixed const = !{1, .b = 2, 3} as basic_struct; - - complex_named const = !{.a = 1, .b = 2, .c = 3} as complex_struct; - /* should parentheses be required around typeof? */ - complex_ordinal const = !{1, 2, 3} as typeof complex_named; - complex_mixed const = !{1, .b = 2, 3} as complex_struct; + simple_named const = {.a = 1, .b = 2, .c = 3} as basic_struct; + complex_named const = {.a = 1, .b = 2, .c = 3} as complex_struct; /* force types */ - force_named complex_struct![u32, u32, u32] = !{.a = 1, .b = 2, .c = 3}; - force_ordinal typeof force_named = !{1, 2, 3}; - force_mixed typeof force_ordinal = !{1, .b = 2, 3}; - - force_inferred_named mut = !{.a = 1, .b = 2, .c = 3} as - complex_struct![u32, u32, u32]; - - force_inferred_ordinal mut = !{1, 2, 3} as + force_named complex_struct![u32, u32, u32] = {.a = 1, .b = 2, .c = 3}; + force_inferred_named mut = {.a = 1, .b = 2, .c = 3} as complex_struct![u32, u32, u32]; - force_inferred_mixed mut = !{1, .b = 2, 3} as - complex_struct![u32, u32, u32]; - - /* shouldn't be compileable due to not enough type info */ - // error_named const = !{.a = 1, .b = 2, .c = 3}; - /* types should be inferred */ - force_inferred_named = !{.a = 2, .b = 3, .c = 4}; - force_inferred_ordinal = !{2, 3, 4}; - force_inferred_mixed = !{2, .b = 3, 4}; + force_inferred_named = {.a = 2, .b = 3, .c = 4}; } -- cgit v1.3