aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-09-24 00:39:51 +0200
committerEugen Wissner <belka@caraus.de>2026-09-24 00:39:51 +0200
commitf7b035a505e86ad916a43ab1dc1a662a6066b011 (patch)
treea54369ae8ad56352d148c4583ab568f7d4869d30 /testsuite
parent74e75e41fe12f19e5365a3152ffafa1a29376240 (diff)
downloadelna-f7b035a505e86ad916a43ab1dc1a662a6066b011.tar.gz
Move module heading to the top
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/compilable/aliased_type_constant.elna2
-rw-r--r--testsuite/compilable/assign_record_to_base.elna6
-rw-r--r--testsuite/compilable/compile_time_array_length.elna2
-rw-r--r--testsuite/compilable/const_alias.elna2
-rw-r--r--testsuite/compilable/const_element_array.elna2
-rw-r--r--testsuite/compilable/const_extern.elna2
-rw-r--r--testsuite/compilable/const_negation.elna4
-rw-r--r--testsuite/compilable/const_var_chain.elna4
-rw-r--r--testsuite/compilable/double_literals.elna2
-rw-r--r--testsuite/compilable/empty_proc.elna2
-rw-r--r--testsuite/compilable/empty_proc_type_expression.elna2
-rw-r--r--testsuite/compilable/empty_statements_in_a_row.elna2
-rw-r--r--testsuite/compilable/generic_alias.elna4
-rw-r--r--testsuite/compilable/generic_arguments.elna8
-rw-r--r--testsuite/compilable/generic_base_chain.elna4
-rw-r--r--testsuite/compilable/generic_inference.elna4
-rw-r--r--testsuite/compilable/opaque_type.elna4
-rw-r--r--testsuite/compilable/pointer_cast.elna4
-rw-r--r--testsuite/compilable/pointer_const_conversion.elna4
-rw-r--r--testsuite/compilable/pointer_subtraction.elna2
-rw-r--r--testsuite/compilable/procedure_forward_reference.elna2
-rw-r--r--testsuite/compilable/record_const_base.elna2
-rw-r--r--testsuite/compilable/self-referencing-record.elna2
-rw-r--r--testsuite/compilable/semicolon_parameter_separator.elna2
-rw-r--r--testsuite/compilable/single_literals.elna2
-rw-r--r--testsuite/compilable/slice_index.elna2
-rw-r--r--testsuite/compilable/take_const_address.elna4
-rw-r--r--testsuite/compilable/trailing_text.elna2
-rw-r--r--testsuite/compilable/traits_size.elna4
-rw-r--r--testsuite/fail_compilation/access_record_type_field.elna2
-rw-r--r--testsuite/fail_compilation/alias-cycle-behind-const.elna3
-rw-r--r--testsuite/fail_compilation/alias-cycle.elna3
-rw-r--r--testsuite/fail_compilation/alias-field-cycle.elna3
-rw-r--r--testsuite/fail_compilation/aligned_attribute.elna6
-rw-r--r--testsuite/fail_compilation/array-cycle.elna3
-rw-r--r--testsuite/fail_compilation/assign_array_length.elna4
-rw-r--r--testsuite/fail_compilation/assign_const_array_pointer.elna2
-rw-r--r--testsuite/fail_compilation/assign_const_element.elna2
-rw-r--r--testsuite/fail_compilation/assign_const_member.elna2
-rw-r--r--testsuite/fail_compilation/assign_const_primitive.elna2
-rw-r--r--testsuite/fail_compilation/assign_const_record_pointer.elna2
-rw-r--r--testsuite/fail_compilation/assign_const_to_pointer.elna4
-rw-r--r--testsuite/fail_compilation/assign_deep_const_pointer.elna2
-rw-r--r--testsuite/fail_compilation/assign_element_of_const.elna2
-rw-r--r--testsuite/fail_compilation/assign_from_const_pointer.elna4
-rw-r--r--testsuite/fail_compilation/assign_member_of_const.elna2
-rw-r--r--testsuite/fail_compilation/assign_slice_ptr.elna4
-rw-r--r--testsuite/fail_compilation/assign_to_call_result_field.elna4
-rw-r--r--testsuite/fail_compilation/assign_to_slicing.elna4
-rw-r--r--testsuite/fail_compilation/assign_void_call.elna4
-rw-r--r--testsuite/fail_compilation/case_label_overflow.elna4
-rw-r--r--testsuite/fail_compilation/case_non_constant.elna4
-rw-r--r--testsuite/fail_compilation/case_type_mismatch.elna4
-rw-r--r--testsuite/fail_compilation/case_unique_label.elna2
-rw-r--r--testsuite/fail_compilation/circular_import/sut.elna2
-rw-r--r--testsuite/fail_compilation/compare_unrelated_records.elna4
-rw-r--r--testsuite/fail_compilation/compile_time_array_ptr.elna2
-rw-r--r--testsuite/fail_compilation/const_array.elna3
-rw-r--r--testsuite/fail_compilation/const_uninitialized.elna2
-rw-r--r--testsuite/fail_compilation/constant_enum_to_int.elna4
-rw-r--r--testsuite/fail_compilation/double_const.elna3
-rw-r--r--testsuite/fail_compilation/enumeration_member_missing.elna2
-rw-r--r--testsuite/fail_compilation/float_remainder.elna2
-rw-r--r--testsuite/fail_compilation/generic_arity.elna6
-rw-r--r--testsuite/fail_compilation/generic_base_mismatch.elna4
-rw-r--r--testsuite/fail_compilation/generic_parameter_arithmetic.elna6
-rw-r--r--testsuite/fail_compilation/generic_uninferrable.elna8
-rw-r--r--testsuite/fail_compilation/import_import_collision/first.elna2
-rw-r--r--testsuite/fail_compilation/import_import_collision/second.elna2
-rw-r--r--testsuite/fail_compilation/import_import_collision/sut.elna2
-rw-r--r--testsuite/fail_compilation/import_local_collision/helper.elna2
-rw-r--r--testsuite/fail_compilation/import_local_collision/sut.elna5
-rw-r--r--testsuite/fail_compilation/local_var_exported.elna2
-rw-r--r--testsuite/fail_compilation/local_var_extern.elna2
-rw-r--r--testsuite/fail_compilation/negative_integer_literal_overflow.elna2
-rw-r--r--testsuite/fail_compilation/non_constant_array_dimension.elna8
-rw-r--r--testsuite/fail_compilation/offset_not_record.elna4
-rw-r--r--testsuite/fail_compilation/opaque_pointer_arithmetic.elna4
-rw-r--r--testsuite/fail_compilation/opaque_slice_element.elna2
-rw-r--r--testsuite/fail_compilation/pointer-cycle.elna2
-rw-r--r--testsuite/fail_compilation/proc_type_without_parameters.elna4
-rw-r--r--testsuite/fail_compilation/procedure-cycle.elna2
-rw-r--r--testsuite/fail_compilation/program_arguments.elna2
-rw-r--r--testsuite/fail_compilation/record-base-cycle-indirect.elna6
-rw-r--r--testsuite/fail_compilation/record-base-cycle.elna2
-rw-r--r--testsuite/fail_compilation/record_base_constructor_type_mismatch.elna4
-rw-r--r--testsuite/fail_compilation/record_duplicate_field.elna2
-rw-r--r--testsuite/fail_compilation/record_duplicate_field_import_base/helper.elna2
-rw-r--r--testsuite/fail_compilation/record_duplicate_field_import_base/sut.elna2
-rw-r--r--testsuite/fail_compilation/redefined_variable.elna2
-rw-r--r--testsuite/fail_compilation/reference_call_result_field.elna4
-rw-r--r--testsuite/fail_compilation/reference_literal.elna4
-rw-r--r--testsuite/fail_compilation/reference_slicing.elna4
-rw-r--r--testsuite/fail_compilation/slice-cycle.elna2
-rw-r--r--testsuite/fail_compilation/unary_minus_on_record.elna2
-rw-r--r--testsuite/fail_compilation/unary_negation_on_record.elna2
-rw-r--r--testsuite/fail_compilation/unary_plus_on_record.elna2
-rw-r--r--testsuite/fail_compilation/varargs_argument.elna4
-rw-r--r--testsuite/fail_compilation/varargs_attribute.elna3
-rw-r--r--testsuite/fail_compilation/while_condition.elna2
-rw-r--r--testsuite/runnable/aggregate_argument.elna4
-rw-r--r--testsuite/runnable/aggregate_equality.elna4
-rw-r--r--testsuite/runnable/aligned_attribute.elna4
-rw-r--r--testsuite/runnable/array_constructor.elna4
-rw-r--r--testsuite/runnable/binary_literal.elna2
-rw-r--r--testsuite/runnable/block_local_variable.elna3
-rw-r--r--testsuite/runnable/case_constant_label.elna4
-rw-r--r--testsuite/runnable/case_else.elna4
-rw-r--r--testsuite/runnable/case_int.elna4
-rw-r--r--testsuite/runnable/case_multilabel.elna4
-rw-r--r--testsuite/runnable/case_record.elna4
-rw-r--r--testsuite/runnable/compile_time_array_access.elna4
-rw-r--r--testsuite/runnable/const_copy.elna4
-rw-r--r--testsuite/runnable/const_initialization.elna4
-rw-r--r--testsuite/runnable/constant_string_initializer.elna4
-rw-r--r--testsuite/runnable/define_multiple_local_variables.elna4
-rw-r--r--testsuite/runnable/exported_variable/helper.elna2
-rw-r--r--testsuite/runnable/exported_variable/sut.elna4
-rw-r--r--testsuite/runnable/fixed_int_max.elna2
-rw-r--r--testsuite/runnable/fixed_int_min.elna2
-rw-r--r--testsuite/runnable/fixed_word_max.elna2
-rw-r--r--testsuite/runnable/float_arithmetic.elna2
-rw-r--r--testsuite/runnable/float_cast.elna4
-rw-r--r--testsuite/runnable/for_call.elna4
-rw-r--r--testsuite/runnable/for_defer.elna4
-rw-r--r--testsuite/runnable/for_each_array.elna4
-rw-r--r--testsuite/runnable/for_each_slice.elna4
-rw-r--r--testsuite/runnable/for_with.elna3
-rw-r--r--testsuite/runnable/generic_base.elna4
-rw-r--r--testsuite/runnable/generic_constructor.elna4
-rw-r--r--testsuite/runnable/generic_erasure.elna4
-rw-r--r--testsuite/runnable/generic_pointer_arithmetic.elna4
-rw-r--r--testsuite/runnable/generic_record.elna4
-rw-r--r--testsuite/runnable/hexadecimal_literal.elna2
-rw-r--r--testsuite/runnable/multi_module/helper.elna2
-rw-r--r--testsuite/runnable/multi_module/sut.elna4
-rw-r--r--testsuite/runnable/named_block.elna4
-rw-r--r--testsuite/runnable/procedure_cast.elna7
-rw-r--r--testsuite/runnable/record_base_assignment.elna4
-rw-r--r--testsuite/runnable/record_base_constructor.elna4
-rw-r--r--testsuite/runnable/record_construction.elna4
-rw-r--r--testsuite/runnable/record_extension.elna4
-rw-r--r--testsuite/runnable/record_layout.elna4
-rw-r--r--testsuite/runnable/recursive_record.elna4
-rw-r--r--testsuite/runnable/repeat_loop.elna4
-rw-r--r--testsuite/runnable/return_aggregate.elna4
-rw-r--r--testsuite/runnable/slice_array.elna4
-rw-r--r--testsuite/runnable/slice_cast.elna4
-rw-r--r--testsuite/runnable/slice_equality.elna4
-rw-r--r--testsuite/runnable/slice_pointer.elna4
-rw-r--r--testsuite/runnable/slice_slice.elna4
-rw-r--r--testsuite/runnable/two_fields_same_type.elna4
-rw-r--r--testsuite/runnable/two_parameters_same_type.elna5
-rw-r--r--testsuite/runnable/unary_plus.elna5
-rw-r--r--testsuite/runnable/unicode_escape_character.elna2
-rw-r--r--testsuite/runnable/unicode_escape_string.elna2
-rw-r--r--testsuite/runnable/varargs.elna4
157 files changed, 225 insertions, 296 deletions
diff --git a/testsuite/compilable/aliased_type_constant.elna b/testsuite/compilable/aliased_type_constant.elna
index 16a52c2..e4054c7 100644
--- a/testsuite/compilable/aliased_type_constant.elna
+++ b/testsuite/compilable/aliased_type_constant.elna
@@ -1,3 +1,5 @@
+module
+
type
Handle = Int
diff --git a/testsuite/compilable/assign_record_to_base.elna b/testsuite/compilable/assign_record_to_base.elna
index 303bde0..14bc3f5 100644
--- a/testsuite/compilable/assign_record_to_base.elna
+++ b/testsuite/compilable/assign_record_to_base.elna
@@ -1,3 +1,4 @@
+program()
type
B = record
x: Int
@@ -10,9 +11,6 @@ var
x: ^B := nil
y: ^R := nil
-program()
begin
- x := y;
-return 0u8
-
+ x := y
end.
diff --git a/testsuite/compilable/compile_time_array_length.elna b/testsuite/compilable/compile_time_array_length.elna
index e38919e..9e2c896 100644
--- a/testsuite/compilable/compile_time_array_length.elna
+++ b/testsuite/compilable/compile_time_array_length.elna
@@ -1,3 +1,5 @@
+module
+
var
source: const [3]Int := [1, 2, 3]
target: Word := source.length
diff --git a/testsuite/compilable/const_alias.elna b/testsuite/compilable/const_alias.elna
index 3a6b365..e4b6434 100644
--- a/testsuite/compilable/const_alias.elna
+++ b/testsuite/compilable/const_alias.elna
@@ -1,3 +1,5 @@
+module
+
type
CI = const Int
CCI = const CI
diff --git a/testsuite/compilable/const_element_array.elna b/testsuite/compilable/const_element_array.elna
index 2d68ff5..d6419fa 100644
--- a/testsuite/compilable/const_element_array.elna
+++ b/testsuite/compilable/const_element_array.elna
@@ -1,3 +1,5 @@
+module
+
type
CI = const Int
diff --git a/testsuite/compilable/const_extern.elna b/testsuite/compilable/const_extern.elna
index 9e8fbb0..6f4b058 100644
--- a/testsuite/compilable/const_extern.elna
+++ b/testsuite/compilable/const_extern.elna
@@ -1,3 +1,5 @@
+module
+
var
errno_like: const Int := extern
diff --git a/testsuite/compilable/const_negation.elna b/testsuite/compilable/const_negation.elna
index 82a4cb6..1dd45f4 100644
--- a/testsuite/compilable/const_negation.elna
+++ b/testsuite/compilable/const_negation.elna
@@ -1,11 +1,9 @@
+program()
var
x: const Int := -5
y: const Int := -x
-program()
begin
assert(x = -5);
assert(y = 5);
-return 0u8
-
end.
diff --git a/testsuite/compilable/const_var_chain.elna b/testsuite/compilable/const_var_chain.elna
index ad85f48..438b79a 100644
--- a/testsuite/compilable/const_var_chain.elna
+++ b/testsuite/compilable/const_var_chain.elna
@@ -1,10 +1,8 @@
+program()
var
x: const Int := 42
y: Int := x
-program()
begin
assert(y = 42)
-return 0u8
-
end.
diff --git a/testsuite/compilable/double_literals.elna b/testsuite/compilable/double_literals.elna
index 9e8a73d..2f2bcdd 100644
--- a/testsuite/compilable/double_literals.elna
+++ b/testsuite/compilable/double_literals.elna
@@ -1,3 +1,5 @@
+module
+
proc f()
var
x: const Double := 3.14
diff --git a/testsuite/compilable/empty_proc.elna b/testsuite/compilable/empty_proc.elna
index bf3bd84..d08593b 100644
--- a/testsuite/compilable/empty_proc.elna
+++ b/testsuite/compilable/empty_proc.elna
@@ -1,3 +1,5 @@
+module
+
proc f()
return
diff --git a/testsuite/compilable/empty_proc_type_expression.elna b/testsuite/compilable/empty_proc_type_expression.elna
index 7738cae..f9c0819 100644
--- a/testsuite/compilable/empty_proc_type_expression.elna
+++ b/testsuite/compilable/empty_proc_type_expression.elna
@@ -1,3 +1,5 @@
+module
+
type
P = proc()
diff --git a/testsuite/compilable/empty_statements_in_a_row.elna b/testsuite/compilable/empty_statements_in_a_row.elna
index 7cf723c..465ab19 100644
--- a/testsuite/compilable/empty_statements_in_a_row.elna
+++ b/testsuite/compilable/empty_statements_in_a_row.elna
@@ -1,3 +1,5 @@
+module
+
proc f()
begin
;
diff --git a/testsuite/compilable/generic_alias.elna b/testsuite/compilable/generic_alias.elna
index 3b431be..47ac638 100644
--- a/testsuite/compilable/generic_alias.elna
+++ b/testsuite/compilable/generic_alias.elna
@@ -1,3 +1,4 @@
+program()
type
File = record
fd: Int
@@ -20,12 +21,9 @@ var
raw: ^^File
boxed: Boxed#[^File]
-program()
begin
chain.next := nil;
aliased := raw;
raw := aliased;
boxed.inner := @chain
-return 0u8
-
end.
diff --git a/testsuite/compilable/generic_arguments.elna b/testsuite/compilable/generic_arguments.elna
index 6bc5242..4d33db5 100644
--- a/testsuite/compilable/generic_arguments.elna
+++ b/testsuite/compilable/generic_arguments.elna
@@ -1,3 +1,4 @@
+program()
type
File = record
fd: Int
@@ -11,18 +12,15 @@ type
var
entry: Pair#[^File, ^Word8]
-proc allocate#[T](size: Word) -> T extern
+proc allocate#[T](size: Word) -> T
+extern
proc first#[K, V](entry_ptr: ^Pair#[K, V]) -> K
-begin
return entry_ptr^.key
-program()
begin
entry.key := allocate#[^File](#size(File));
assert(#size(Pair#[^File, ^Word8]) = #size(Pointer) * 2u);
assert(#offset(Pair#[^File, ^Word8], value) = #size(Pointer));
assert(first#[^File, ^Word8](@entry) = entry.key)
-return 0u8
-
end.
diff --git a/testsuite/compilable/generic_base_chain.elna b/testsuite/compilable/generic_base_chain.elna
index 736042b..c303e6d 100644
--- a/testsuite/compilable/generic_base_chain.elna
+++ b/testsuite/compilable/generic_base_chain.elna
@@ -1,3 +1,4 @@
+program()
type
File = record
fd: Int
@@ -22,10 +23,7 @@ begin
target^.key := key
return
-program()
begin
upcast := @store;
put(@store, byte_key)
-return 0u8
-
end.
diff --git a/testsuite/compilable/generic_inference.elna b/testsuite/compilable/generic_inference.elna
index 25faca4..ab1ff3a 100644
--- a/testsuite/compilable/generic_inference.elna
+++ b/testsuite/compilable/generic_inference.elna
@@ -1,3 +1,4 @@
+program()
type
File = record
fd: Int
@@ -23,11 +24,8 @@ begin
store(target, value)
return
-program()
begin
store(@files, @f);
relay(@bytes, @b);
store(@files, nil)
-return 0u8
-
end.
diff --git a/testsuite/compilable/opaque_type.elna b/testsuite/compilable/opaque_type.elna
index c570e0d..6474337 100644
--- a/testsuite/compilable/opaque_type.elna
+++ b/testsuite/compilable/opaque_type.elna
@@ -1,3 +1,4 @@
+program()
type
Handle = extern
Alias = Handle
@@ -9,9 +10,6 @@ var
proc take(h: ^Handle) -> ^Handle
return h
-program()
begin
alias := take(handle)
-return 0u8
-
end.
diff --git a/testsuite/compilable/pointer_cast.elna b/testsuite/compilable/pointer_cast.elna
index ad15432..2b986c0 100644
--- a/testsuite/compilable/pointer_cast.elna
+++ b/testsuite/compilable/pointer_cast.elna
@@ -1,11 +1,9 @@
+program()
var
c: ^Char := nil
p: Pointer := nil
-program()
begin
p := c;
c := p
-return 0u8
-
end.
diff --git a/testsuite/compilable/pointer_const_conversion.elna b/testsuite/compilable/pointer_const_conversion.elna
index a5bd297..c08862b 100644
--- a/testsuite/compilable/pointer_const_conversion.elna
+++ b/testsuite/compilable/pointer_const_conversion.elna
@@ -1,10 +1,8 @@
+program()
var
x: Int
p: ^const Int
-program()
begin
p := @x
-return 0u8
-
end.
diff --git a/testsuite/compilable/pointer_subtraction.elna b/testsuite/compilable/pointer_subtraction.elna
index 8dd1ff6..738845d 100644
--- a/testsuite/compilable/pointer_subtraction.elna
+++ b/testsuite/compilable/pointer_subtraction.elna
@@ -1,3 +1,5 @@
+module
+
proc test(a, b: ^Char) -> Int
return a - b
diff --git a/testsuite/compilable/procedure_forward_reference.elna b/testsuite/compilable/procedure_forward_reference.elna
index cdf3008..0e6f93c 100644
--- a/testsuite/compilable/procedure_forward_reference.elna
+++ b/testsuite/compilable/procedure_forward_reference.elna
@@ -1,3 +1,5 @@
+module
+
proc first() -> Int
return second() + 1
diff --git a/testsuite/compilable/record_const_base.elna b/testsuite/compilable/record_const_base.elna
index f24d27b..a4c6b7b 100644
--- a/testsuite/compilable/record_const_base.elna
+++ b/testsuite/compilable/record_const_base.elna
@@ -1,3 +1,5 @@
+module
+
type
B = record
x: Int
diff --git a/testsuite/compilable/self-referencing-record.elna b/testsuite/compilable/self-referencing-record.elna
index 311f148..d340492 100644
--- a/testsuite/compilable/self-referencing-record.elna
+++ b/testsuite/compilable/self-referencing-record.elna
@@ -1,3 +1,5 @@
+module
+
type
R = record
field: ^R
diff --git a/testsuite/compilable/semicolon_parameter_separator.elna b/testsuite/compilable/semicolon_parameter_separator.elna
index 229fde0..c998606 100644
--- a/testsuite/compilable/semicolon_parameter_separator.elna
+++ b/testsuite/compilable/semicolon_parameter_separator.elna
@@ -1,3 +1,5 @@
+module
+
proc f(a: Int; b: Word)
return
diff --git a/testsuite/compilable/single_literals.elna b/testsuite/compilable/single_literals.elna
index ac03623..a18d2ca 100644
--- a/testsuite/compilable/single_literals.elna
+++ b/testsuite/compilable/single_literals.elna
@@ -1,3 +1,5 @@
+module
+
proc f()
var
x: const Single := 3.14f
diff --git a/testsuite/compilable/slice_index.elna b/testsuite/compilable/slice_index.elna
index 70d26ae..13121eb 100644
--- a/testsuite/compilable/slice_index.elna
+++ b/testsuite/compilable/slice_index.elna
@@ -1,3 +1,5 @@
+module
+
proc f()
var
a: []Int
diff --git a/testsuite/compilable/take_const_address.elna b/testsuite/compilable/take_const_address.elna
index 4f82b2a..a60b1c2 100644
--- a/testsuite/compilable/take_const_address.elna
+++ b/testsuite/compilable/take_const_address.elna
@@ -1,10 +1,8 @@
+program()
var
x: ^const Int
y: const Int := 1
-program()
begin
x := @y
-return 0u8
-
end.
diff --git a/testsuite/compilable/trailing_text.elna b/testsuite/compilable/trailing_text.elna
index 1eb3595..0a95516 100644
--- a/testsuite/compilable/trailing_text.elna
+++ b/testsuite/compilable/trailing_text.elna
@@ -1,3 +1,5 @@
+module
+
end.
Everything after the module terminator is ignored and is never scanned, so it
diff --git a/testsuite/compilable/traits_size.elna b/testsuite/compilable/traits_size.elna
index f245637..ad49b61 100644
--- a/testsuite/compilable/traits_size.elna
+++ b/testsuite/compilable/traits_size.elna
@@ -1,3 +1,4 @@
+program()
var
i: Int := 1
s: Int := cast(#size(Int): Int)
@@ -5,11 +6,8 @@ var
as: Int := cast(#size([10]Int): Int)
p: Int := cast(#size(Pointer): Int)
-program()
begin
assert(s > 0);
assert(as = 10 * cast(#size(Int): Int));
assert(p > 0)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/access_record_type_field.elna b/testsuite/fail_compilation/access_record_type_field.elna
index 4378404..4dcdceb 100644
--- a/testsuite/fail_compilation/access_record_type_field.elna
+++ b/testsuite/fail_compilation/access_record_type_field.elna
@@ -1,3 +1,5 @@
+module
+
type
R = record
field1, field2: Int
diff --git a/testsuite/fail_compilation/alias-cycle-behind-const.elna b/testsuite/fail_compilation/alias-cycle-behind-const.elna
index 0c3b626..a05240b 100644
--- a/testsuite/fail_compilation/alias-cycle-behind-const.elna
+++ b/testsuite/fail_compilation/alias-cycle-behind-const.elna
@@ -1,4 +1,7 @@
+module
+
type
A = B
B = const A (* @Error Type declaration forms a cycle: A -> B -> A *)
+
end.
diff --git a/testsuite/fail_compilation/alias-cycle.elna b/testsuite/fail_compilation/alias-cycle.elna
index e6c822b..ba05947 100644
--- a/testsuite/fail_compilation/alias-cycle.elna
+++ b/testsuite/fail_compilation/alias-cycle.elna
@@ -1,4 +1,7 @@
+module
+
type
A = B
B = A (* @Error Type declaration forms a cycle: A -> B -> A *)
+
end.
diff --git a/testsuite/fail_compilation/alias-field-cycle.elna b/testsuite/fail_compilation/alias-field-cycle.elna
index f4a554a..8296c69 100644
--- a/testsuite/fail_compilation/alias-field-cycle.elna
+++ b/testsuite/fail_compilation/alias-field-cycle.elna
@@ -1,5 +1,8 @@
+module
+
type
A = record (* @Error Type declaration forms a cycle: A -> A *)
field: A
end
+
end.
diff --git a/testsuite/fail_compilation/aligned_attribute.elna b/testsuite/fail_compilation/aligned_attribute.elna
index aab5513..46a9b94 100644
--- a/testsuite/fail_compilation/aligned_attribute.elna
+++ b/testsuite/fail_compilation/aligned_attribute.elna
@@ -1,3 +1,4 @@
+module
type
Uneven = record
x #{aligned 3}: Word8 (* @Error Alignment must be a power of two *)
@@ -10,11 +11,6 @@ type
end
proc takes(p #{aligned 8}: Int) (* @Error Attribute 'aligned' is not supported in this position *)
-begin
return
-program()
-begin
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/array-cycle.elna b/testsuite/fail_compilation/array-cycle.elna
index 617e23d..a5b79c2 100644
--- a/testsuite/fail_compilation/array-cycle.elna
+++ b/testsuite/fail_compilation/array-cycle.elna
@@ -1,3 +1,6 @@
+module
+
type
A = [2]A (* @Error Type declaration forms a cycle: A -> A *)
+
end.
diff --git a/testsuite/fail_compilation/assign_array_length.elna b/testsuite/fail_compilation/assign_array_length.elna
index 92d6769..c794b11 100644
--- a/testsuite/fail_compilation/assign_array_length.elna
+++ b/testsuite/fail_compilation/assign_array_length.elna
@@ -1,10 +1,8 @@
+program()
var
slice: []Int
array: [2]Int
-program()
begin
array.length := slice.length (* @Error Cannot assign to a value of type 'const Word', because it is constant or contains constant members *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/assign_const_array_pointer.elna b/testsuite/fail_compilation/assign_const_array_pointer.elna
index 32dc66d..d8ecb72 100644
--- a/testsuite/fail_compilation/assign_const_array_pointer.elna
+++ b/testsuite/fail_compilation/assign_const_array_pointer.elna
@@ -1,3 +1,5 @@
+module
+
proc f()
var
p: ^[2]Int
diff --git a/testsuite/fail_compilation/assign_const_element.elna b/testsuite/fail_compilation/assign_const_element.elna
index 9b9c341..721d337 100644
--- a/testsuite/fail_compilation/assign_const_element.elna
+++ b/testsuite/fail_compilation/assign_const_element.elna
@@ -1,3 +1,5 @@
+module
+
type
CI = const Int
diff --git a/testsuite/fail_compilation/assign_const_member.elna b/testsuite/fail_compilation/assign_const_member.elna
index 8aecb01..a603729 100644
--- a/testsuite/fail_compilation/assign_const_member.elna
+++ b/testsuite/fail_compilation/assign_const_member.elna
@@ -1,3 +1,5 @@
+module
+
type
R = record
x: const Int
diff --git a/testsuite/fail_compilation/assign_const_primitive.elna b/testsuite/fail_compilation/assign_const_primitive.elna
index 22fef25..2db9c85 100644
--- a/testsuite/fail_compilation/assign_const_primitive.elna
+++ b/testsuite/fail_compilation/assign_const_primitive.elna
@@ -1,3 +1,5 @@
+module
+
proc f()
var
x: const Int := 4
diff --git a/testsuite/fail_compilation/assign_const_record_pointer.elna b/testsuite/fail_compilation/assign_const_record_pointer.elna
index 5e6f3df..adf3d91 100644
--- a/testsuite/fail_compilation/assign_const_record_pointer.elna
+++ b/testsuite/fail_compilation/assign_const_record_pointer.elna
@@ -1,3 +1,5 @@
+module
+
type
B = record
x: Int
diff --git a/testsuite/fail_compilation/assign_const_to_pointer.elna b/testsuite/fail_compilation/assign_const_to_pointer.elna
index 50e4a44..796b60c 100644
--- a/testsuite/fail_compilation/assign_const_to_pointer.elna
+++ b/testsuite/fail_compilation/assign_const_to_pointer.elna
@@ -1,10 +1,8 @@
+program()
var
c: const Int := 2
p: Pointer
-program()
begin
p := @c (* @Error Expected type 'Pointer', but got '\^const Int' *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/assign_deep_const_pointer.elna b/testsuite/fail_compilation/assign_deep_const_pointer.elna
index 7ed3840..7c977d4 100644
--- a/testsuite/fail_compilation/assign_deep_const_pointer.elna
+++ b/testsuite/fail_compilation/assign_deep_const_pointer.elna
@@ -1,3 +1,5 @@
+module
+
proc f()
var
p: ^^const Int
diff --git a/testsuite/fail_compilation/assign_element_of_const.elna b/testsuite/fail_compilation/assign_element_of_const.elna
index 8235448..a51822b 100644
--- a/testsuite/fail_compilation/assign_element_of_const.elna
+++ b/testsuite/fail_compilation/assign_element_of_const.elna
@@ -1,3 +1,5 @@
+module
+
proc f()
var
a: const [2]Int := [1, 3]
diff --git a/testsuite/fail_compilation/assign_from_const_pointer.elna b/testsuite/fail_compilation/assign_from_const_pointer.elna
index 4c383cc..64f7f5d 100644
--- a/testsuite/fail_compilation/assign_from_const_pointer.elna
+++ b/testsuite/fail_compilation/assign_from_const_pointer.elna
@@ -1,10 +1,8 @@
+program()
var
cv: const Pointer := nil
p: Pointer
-program()
begin
p := cv (* @Error Expected type 'Pointer', but got 'const Pointer' *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/assign_member_of_const.elna b/testsuite/fail_compilation/assign_member_of_const.elna
index fc945bb..efdf67b 100644
--- a/testsuite/fail_compilation/assign_member_of_const.elna
+++ b/testsuite/fail_compilation/assign_member_of_const.elna
@@ -1,3 +1,5 @@
+module
+
type
R = record
x: Int
diff --git a/testsuite/fail_compilation/assign_slice_ptr.elna b/testsuite/fail_compilation/assign_slice_ptr.elna
index fa3dd22..b4e72f1 100644
--- a/testsuite/fail_compilation/assign_slice_ptr.elna
+++ b/testsuite/fail_compilation/assign_slice_ptr.elna
@@ -1,10 +1,8 @@
+program()
var
slice: []Int
array: [2]Int
-program()
begin
slice.ptr := array.ptr (* @Error Cannot assign to a value of type 'const \^Int', because it is constant or contains constant members *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/assign_to_call_result_field.elna b/testsuite/fail_compilation/assign_to_call_result_field.elna
index 50cd135..e4995e5 100644
--- a/testsuite/fail_compilation/assign_to_call_result_field.elna
+++ b/testsuite/fail_compilation/assign_to_call_result_field.elna
@@ -1,3 +1,4 @@
+program()
type
R = record
x: Int
@@ -10,9 +11,6 @@ begin
result.x := 1
return result
-program()
begin
make().x := 5 (* @Error Expression of type 'Int' is not addressable *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/assign_to_slicing.elna b/testsuite/fail_compilation/assign_to_slicing.elna
index 92d0dae..da369b3 100644
--- a/testsuite/fail_compilation/assign_to_slicing.elna
+++ b/testsuite/fail_compilation/assign_to_slicing.elna
@@ -1,10 +1,8 @@
+program()
var
s: [3]Int
t: [2]Int
-program()
begin
s[1 to 2] := t[1 to 2] (* @Error Expression of type '\[\]Int' is not addressable *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/assign_void_call.elna b/testsuite/fail_compilation/assign_void_call.elna
index 75f7c6b..ecdba8d 100644
--- a/testsuite/fail_compilation/assign_void_call.elna
+++ b/testsuite/fail_compilation/assign_void_call.elna
@@ -1,12 +1,10 @@
+program()
var
x: Int
proc v()
return
-program()
begin
x := v() (* @Error Expected type 'Int', but the expression has no value *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/case_label_overflow.elna b/testsuite/fail_compilation/case_label_overflow.elna
index def83e9..cfed88a 100644
--- a/testsuite/fail_compilation/case_label_overflow.elna
+++ b/testsuite/fail_compilation/case_label_overflow.elna
@@ -1,7 +1,7 @@
+program()
var
x: Int8 := 100i8
-program()
begin
case x of
100i8: assert(true)
@@ -9,6 +9,4 @@ begin
else
assert(false)
end
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/case_non_constant.elna b/testsuite/fail_compilation/case_non_constant.elna
index 0345653..9f7ba9a 100644
--- a/testsuite/fail_compilation/case_non_constant.elna
+++ b/testsuite/fail_compilation/case_non_constant.elna
@@ -1,3 +1,4 @@
+program()
type
R = record
a: Int;
@@ -8,12 +9,9 @@ var
r: R
x: R
-program()
begin
x := r;
case x of
r: (* @Error Case label must be a constant expression *)
end
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/case_type_mismatch.elna b/testsuite/fail_compilation/case_type_mismatch.elna
index 56be244..f2db7e7 100644
--- a/testsuite/fail_compilation/case_type_mismatch.elna
+++ b/testsuite/fail_compilation/case_type_mismatch.elna
@@ -1,12 +1,10 @@
+program()
var
x: Int
-program()
begin
case x of
1: (* ok *)
| true: (* @Error Invalid operands of type 'Int' and 'Bool' for operator = *)
end
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/case_unique_label.elna b/testsuite/fail_compilation/case_unique_label.elna
index 95d5f53..7ee8391 100644
--- a/testsuite/fail_compilation/case_unique_label.elna
+++ b/testsuite/fail_compilation/case_unique_label.elna
@@ -5,6 +5,4 @@ begin
| 3:
| 1 + 2: (* @Error Duplicate case label *)
end
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/circular_import/sut.elna b/testsuite/fail_compilation/circular_import/sut.elna
index f6452fb..7641a73 100644
--- a/testsuite/fail_compilation/circular_import/sut.elna
+++ b/testsuite/fail_compilation/circular_import/sut.elna
@@ -1,3 +1,5 @@
+module
+
import sut (* @Error Circular import of module 'sut' *)
end.
diff --git a/testsuite/fail_compilation/compare_unrelated_records.elna b/testsuite/fail_compilation/compare_unrelated_records.elna
index 4b04aa7..a113809 100644
--- a/testsuite/fail_compilation/compare_unrelated_records.elna
+++ b/testsuite/fail_compilation/compare_unrelated_records.elna
@@ -1,3 +1,4 @@
+program()
type
A = record
x: Int
@@ -12,9 +13,6 @@ var
b: B
ok: Bool
-program()
begin
ok := b = a (* @Error Invalid operands of type 'B' and 'A' for operator = *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/compile_time_array_ptr.elna b/testsuite/fail_compilation/compile_time_array_ptr.elna
index bd630ac..f11f2f2 100644
--- a/testsuite/fail_compilation/compile_time_array_ptr.elna
+++ b/testsuite/fail_compilation/compile_time_array_ptr.elna
@@ -1,3 +1,5 @@
+module
+
var
source: [3]Int := [1, 2, 3]
target: ^Int := source.ptr (* @Error Variable initializers must be constant expressions *)
diff --git a/testsuite/fail_compilation/const_array.elna b/testsuite/fail_compilation/const_array.elna
index 7a1a6f5..d42f0b4 100644
--- a/testsuite/fail_compilation/const_array.elna
+++ b/testsuite/fail_compilation/const_array.elna
@@ -1,7 +1,8 @@
+module
+
proc f()
var
a: [10]const Int (* @Error const must be written before the array size, not after *)
-begin
return
end.
diff --git a/testsuite/fail_compilation/const_uninitialized.elna b/testsuite/fail_compilation/const_uninitialized.elna
index 06db3d7..a3be5d3 100644
--- a/testsuite/fail_compilation/const_uninitialized.elna
+++ b/testsuite/fail_compilation/const_uninitialized.elna
@@ -1,3 +1,5 @@
+module
+
var
x: const Int (* @Error All constants should be initialized *)
diff --git a/testsuite/fail_compilation/constant_enum_to_int.elna b/testsuite/fail_compilation/constant_enum_to_int.elna
index 85f6d4c..194109b 100644
--- a/testsuite/fail_compilation/constant_enum_to_int.elna
+++ b/testsuite/fail_compilation/constant_enum_to_int.elna
@@ -1,3 +1,4 @@
+program()
type
Enumeration = (one, two, three)
@@ -5,9 +6,6 @@ var
x: [3]Int := [1, 2, 3]
y: []Int
-program()
begin
y := x[Enumeration.one to Enumeration.two] (* @Error Array index must be an integral type, but got 'Enumeration' *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/double_const.elna b/testsuite/fail_compilation/double_const.elna
index 204a7f7..fe1b134 100644
--- a/testsuite/fail_compilation/double_const.elna
+++ b/testsuite/fail_compilation/double_const.elna
@@ -1,7 +1,8 @@
+module
+
proc f()
var
x: const const Int (* @Error Duplicate 'const' qualifier is not allowed *)
-begin
return
end.
diff --git a/testsuite/fail_compilation/enumeration_member_missing.elna b/testsuite/fail_compilation/enumeration_member_missing.elna
index 6f82131..69f1eed 100644
--- a/testsuite/fail_compilation/enumeration_member_missing.elna
+++ b/testsuite/fail_compilation/enumeration_member_missing.elna
@@ -1,3 +1,5 @@
+module
+
type
Enumeration = (one, two, three)
diff --git a/testsuite/fail_compilation/float_remainder.elna b/testsuite/fail_compilation/float_remainder.elna
index ec6c9e2..f2eba60 100644
--- a/testsuite/fail_compilation/float_remainder.elna
+++ b/testsuite/fail_compilation/float_remainder.elna
@@ -1,3 +1,5 @@
+module
+
proc f()
var
x: Double
diff --git a/testsuite/fail_compilation/generic_arity.elna b/testsuite/fail_compilation/generic_arity.elna
index bb234af..645aded 100644
--- a/testsuite/fail_compilation/generic_arity.elna
+++ b/testsuite/fail_compilation/generic_arity.elna
@@ -1,3 +1,5 @@
+module
+
type
Stack#[T] = record
items: T
@@ -6,8 +8,4 @@ type
var
broken: Stack (* @Error Too few type arguments for generic 'Stack', expected 1, got 0 *)
-program()
-begin
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/generic_base_mismatch.elna b/testsuite/fail_compilation/generic_base_mismatch.elna
index 64e0c40..e361052 100644
--- a/testsuite/fail_compilation/generic_base_mismatch.elna
+++ b/testsuite/fail_compilation/generic_base_mismatch.elna
@@ -1,3 +1,4 @@
+program()
type
File = record
fd: Int
@@ -18,9 +19,6 @@ var
jobs: Queue#[^File]
wrong: ^List#[^Socket]
-program()
begin
wrong := @jobs (* @Error Expected type '\^List#\[\^Socket\]', but got '\^Queue#\[\^File\]' *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/generic_parameter_arithmetic.elna b/testsuite/fail_compilation/generic_parameter_arithmetic.elna
index 969c5c7..e05b1ee 100644
--- a/testsuite/fail_compilation/generic_parameter_arithmetic.elna
+++ b/testsuite/fail_compilation/generic_parameter_arithmetic.elna
@@ -1,11 +1,9 @@
+module
+
proc walk#[T](value: T; step: ^T)
begin
step := step + 1;
value := value + 1 (* @Error Type parameter 'T' cannot be used in pointer arithmetic *)
return
-program()
-begin
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/generic_uninferrable.elna b/testsuite/fail_compilation/generic_uninferrable.elna
index 20d3d25..b3556d6 100644
--- a/testsuite/fail_compilation/generic_uninferrable.elna
+++ b/testsuite/fail_compilation/generic_uninferrable.elna
@@ -1,10 +1,10 @@
-proc allocate#[R](size: Word) -> R extern
-
program()
var
got: ^Word8
+
+proc allocate#[R](size: Word) -> R
+extern
+
begin
got := allocate(8u) (* @Error Type parameter 'R' of 'allocate' cannot be inferred *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/import_import_collision/first.elna b/testsuite/fail_compilation/import_import_collision/first.elna
index e60ca8e..251eaee 100644
--- a/testsuite/fail_compilation/import_import_collision/first.elna
+++ b/testsuite/fail_compilation/import_import_collision/first.elna
@@ -1,3 +1,5 @@
+module
+
var
X*: Int := 1
diff --git a/testsuite/fail_compilation/import_import_collision/second.elna b/testsuite/fail_compilation/import_import_collision/second.elna
index 0a3d8e0..65f1ed3 100644
--- a/testsuite/fail_compilation/import_import_collision/second.elna
+++ b/testsuite/fail_compilation/import_import_collision/second.elna
@@ -1,3 +1,5 @@
+module
+
var
X*: Int := 2
diff --git a/testsuite/fail_compilation/import_import_collision/sut.elna b/testsuite/fail_compilation/import_import_collision/sut.elna
index 208aa21..657113d 100644
--- a/testsuite/fail_compilation/import_import_collision/sut.elna
+++ b/testsuite/fail_compilation/import_import_collision/sut.elna
@@ -1,3 +1,5 @@
+module
+
import first, second (* @Error Symbol 'X' has been already defined *)
end.
diff --git a/testsuite/fail_compilation/import_local_collision/helper.elna b/testsuite/fail_compilation/import_local_collision/helper.elna
index e60ca8e..251eaee 100644
--- a/testsuite/fail_compilation/import_local_collision/helper.elna
+++ b/testsuite/fail_compilation/import_local_collision/helper.elna
@@ -1,3 +1,5 @@
+module
+
var
X*: Int := 1
diff --git a/testsuite/fail_compilation/import_local_collision/sut.elna b/testsuite/fail_compilation/import_local_collision/sut.elna
index ecac1ca..c628941 100644
--- a/testsuite/fail_compilation/import_local_collision/sut.elna
+++ b/testsuite/fail_compilation/import_local_collision/sut.elna
@@ -1,9 +1,8 @@
+program()
+
import helper
var
X: Int (* @Error Symbol 'X' has been already defined *)
-program()
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/local_var_exported.elna b/testsuite/fail_compilation/local_var_exported.elna
index 307d34f..be0183d 100644
--- a/testsuite/fail_compilation/local_var_exported.elna
+++ b/testsuite/fail_compilation/local_var_exported.elna
@@ -1,3 +1,5 @@
+module
+
proc test_local_export()
var
v* : Int (* @Error Local symbols cannot be exported *)
diff --git a/testsuite/fail_compilation/local_var_extern.elna b/testsuite/fail_compilation/local_var_extern.elna
index d0eb22f..948689c 100644
--- a/testsuite/fail_compilation/local_var_extern.elna
+++ b/testsuite/fail_compilation/local_var_extern.elna
@@ -1,3 +1,5 @@
+module
+
proc test_local_extern()
var
v : Int := extern (* @Error Local symbols cannot be extern *)
diff --git a/testsuite/fail_compilation/negative_integer_literal_overflow.elna b/testsuite/fail_compilation/negative_integer_literal_overflow.elna
index 7db4888..fa90009 100644
--- a/testsuite/fail_compilation/negative_integer_literal_overflow.elna
+++ b/testsuite/fail_compilation/negative_integer_literal_overflow.elna
@@ -1,3 +1,5 @@
+module
+
var
a: Int8 := -200i8 (* @Error Integer literal overflows *)
diff --git a/testsuite/fail_compilation/non_constant_array_dimension.elna b/testsuite/fail_compilation/non_constant_array_dimension.elna
index 8efb9e9..3c69b7e 100644
--- a/testsuite/fail_compilation/non_constant_array_dimension.elna
+++ b/testsuite/fail_compilation/non_constant_array_dimension.elna
@@ -1,12 +1,10 @@
+program()
+
proc f(len: Int)
var
array: [len]Int (* @Error Array dimensions for type 'Int' should be constant *)
-begin
- return
+return
-program()
begin
f(5)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/offset_not_record.elna b/testsuite/fail_compilation/offset_not_record.elna
index d19e608..93459e4 100644
--- a/testsuite/fail_compilation/offset_not_record.elna
+++ b/testsuite/fail_compilation/offset_not_record.elna
@@ -1,9 +1,7 @@
+program()
var
n: Word
-program()
begin
n := #offset(Int, top) (* @Error Type 'Int' does not support trait '#offset' *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/opaque_pointer_arithmetic.elna b/testsuite/fail_compilation/opaque_pointer_arithmetic.elna
index cb3a20e..117994a 100644
--- a/testsuite/fail_compilation/opaque_pointer_arithmetic.elna
+++ b/testsuite/fail_compilation/opaque_pointer_arithmetic.elna
@@ -1,12 +1,10 @@
+program()
type
Handle = extern
var
p: ^Handle
-program()
begin
p := p + 1 (* @Error Opaque type 'Handle' cannot be used as an element type in pointer arithmetic *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/opaque_slice_element.elna b/testsuite/fail_compilation/opaque_slice_element.elna
index f50be8a..1dc341d 100644
--- a/testsuite/fail_compilation/opaque_slice_element.elna
+++ b/testsuite/fail_compilation/opaque_slice_element.elna
@@ -1,3 +1,5 @@
+module
+
type
Handle = extern
diff --git a/testsuite/fail_compilation/pointer-cycle.elna b/testsuite/fail_compilation/pointer-cycle.elna
index fe0258a..f2ed05c 100644
--- a/testsuite/fail_compilation/pointer-cycle.elna
+++ b/testsuite/fail_compilation/pointer-cycle.elna
@@ -1,3 +1,5 @@
+module
+
type
A = ^A (* @Error Type declaration forms a cycle: A -> A *)
diff --git a/testsuite/fail_compilation/proc_type_without_parameters.elna b/testsuite/fail_compilation/proc_type_without_parameters.elna
index f7cdffe..d15b7f5 100644
--- a/testsuite/fail_compilation/proc_type_without_parameters.elna
+++ b/testsuite/fail_compilation/proc_type_without_parameters.elna
@@ -1,12 +1,10 @@
+program()
var
x: Int
proc f()
return
-program()
begin
x := f (* @Error Expected type 'Int', but got 'proc\(\)' *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/procedure-cycle.elna b/testsuite/fail_compilation/procedure-cycle.elna
index 2284605..f9a128d 100644
--- a/testsuite/fail_compilation/procedure-cycle.elna
+++ b/testsuite/fail_compilation/procedure-cycle.elna
@@ -1,3 +1,5 @@
+module
+
type
A = proc() -> A (* @Error Type declaration forms a cycle: A -> A *)
diff --git a/testsuite/fail_compilation/program_arguments.elna b/testsuite/fail_compilation/program_arguments.elna
index e614368..73c38df 100644
--- a/testsuite/fail_compilation/program_arguments.elna
+++ b/testsuite/fail_compilation/program_arguments.elna
@@ -1,4 +1,2 @@
program(first, second) (* @Error Program entry point should have no or one argument *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/record-base-cycle-indirect.elna b/testsuite/fail_compilation/record-base-cycle-indirect.elna
index f60b1aa..75c9805 100644
--- a/testsuite/fail_compilation/record-base-cycle-indirect.elna
+++ b/testsuite/fail_compilation/record-base-cycle-indirect.elna
@@ -1,3 +1,5 @@
+module
+
type
A = record(B)
x: Int
@@ -9,8 +11,4 @@ type
var
v: A
-program()
-begin
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/record-base-cycle.elna b/testsuite/fail_compilation/record-base-cycle.elna
index 8af254d..ea3d888 100644
--- a/testsuite/fail_compilation/record-base-cycle.elna
+++ b/testsuite/fail_compilation/record-base-cycle.elna
@@ -1,3 +1,5 @@
+module
+
type
R = record(R) (* @Error Type declaration forms a cycle: R -> R *)
end
diff --git a/testsuite/fail_compilation/record_base_constructor_type_mismatch.elna b/testsuite/fail_compilation/record_base_constructor_type_mismatch.elna
index 621a06c..d7a8419 100644
--- a/testsuite/fail_compilation/record_base_constructor_type_mismatch.elna
+++ b/testsuite/fail_compilation/record_base_constructor_type_mismatch.elna
@@ -1,3 +1,4 @@
+program()
type
Base = record
a: Int
@@ -9,9 +10,6 @@ type
var
c: Child
-program()
begin
c := Child{a: "wrong", b: 9} (* @Error Expected type 'Int', but got '\[\]const Word8' *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/record_duplicate_field.elna b/testsuite/fail_compilation/record_duplicate_field.elna
index 5cf69a9..0cdfbaa 100644
--- a/testsuite/fail_compilation/record_duplicate_field.elna
+++ b/testsuite/fail_compilation/record_duplicate_field.elna
@@ -1,3 +1,5 @@
+module
+
type
R = record
x: Int;
diff --git a/testsuite/fail_compilation/record_duplicate_field_import_base/helper.elna b/testsuite/fail_compilation/record_duplicate_field_import_base/helper.elna
index 0edb965..7865a3f 100644
--- a/testsuite/fail_compilation/record_duplicate_field_import_base/helper.elna
+++ b/testsuite/fail_compilation/record_duplicate_field_import_base/helper.elna
@@ -1,3 +1,5 @@
+module
+
type
Parent* = record
x: Int;
diff --git a/testsuite/fail_compilation/record_duplicate_field_import_base/sut.elna b/testsuite/fail_compilation/record_duplicate_field_import_base/sut.elna
index 58f2f3d..97d9a2f 100644
--- a/testsuite/fail_compilation/record_duplicate_field_import_base/sut.elna
+++ b/testsuite/fail_compilation/record_duplicate_field_import_base/sut.elna
@@ -1,3 +1,5 @@
+module
+
import helper
type
diff --git a/testsuite/fail_compilation/redefined_variable.elna b/testsuite/fail_compilation/redefined_variable.elna
index 905f6ed..1856807 100644
--- a/testsuite/fail_compilation/redefined_variable.elna
+++ b/testsuite/fail_compilation/redefined_variable.elna
@@ -1,3 +1,5 @@
+module
+
var
x: Int
x: Int (* @Error Symbol 'x' has been already defined *)
diff --git a/testsuite/fail_compilation/reference_call_result_field.elna b/testsuite/fail_compilation/reference_call_result_field.elna
index d339ed9..b10d324 100644
--- a/testsuite/fail_compilation/reference_call_result_field.elna
+++ b/testsuite/fail_compilation/reference_call_result_field.elna
@@ -1,3 +1,4 @@
+program()
type
R = record
x: Int
@@ -13,9 +14,6 @@ begin
result.x := 1
return result
-program()
begin
p := @make().x (* @Error Expression of type 'Int' is not addressable *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/reference_literal.elna b/testsuite/fail_compilation/reference_literal.elna
index 26d5a22..72eb986 100644
--- a/testsuite/fail_compilation/reference_literal.elna
+++ b/testsuite/fail_compilation/reference_literal.elna
@@ -1,9 +1,7 @@
+program()
var
p: ^Int
-program()
begin
p := @5 (* @Error Expression of type 'Int' is not addressable *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/reference_slicing.elna b/testsuite/fail_compilation/reference_slicing.elna
index 3875a5d..838e101 100644
--- a/testsuite/fail_compilation/reference_slicing.elna
+++ b/testsuite/fail_compilation/reference_slicing.elna
@@ -1,10 +1,8 @@
+program()
var
s: [3]Int
p: ^Int
-program()
begin
p := @s[1 to 2] (* @Error Expression of type '\[\]Int' is not addressable *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/slice-cycle.elna b/testsuite/fail_compilation/slice-cycle.elna
index fe0a3e1..0ee44a9 100644
--- a/testsuite/fail_compilation/slice-cycle.elna
+++ b/testsuite/fail_compilation/slice-cycle.elna
@@ -1,3 +1,5 @@
+module
+
type
A = []A (* @Error Type declaration forms a cycle: A -> A *)
diff --git a/testsuite/fail_compilation/unary_minus_on_record.elna b/testsuite/fail_compilation/unary_minus_on_record.elna
index d86995b..30da92c 100644
--- a/testsuite/fail_compilation/unary_minus_on_record.elna
+++ b/testsuite/fail_compilation/unary_minus_on_record.elna
@@ -1,3 +1,5 @@
+module
+
type
R = record
x: Int
diff --git a/testsuite/fail_compilation/unary_negation_on_record.elna b/testsuite/fail_compilation/unary_negation_on_record.elna
index d08d2e3..750f828 100644
--- a/testsuite/fail_compilation/unary_negation_on_record.elna
+++ b/testsuite/fail_compilation/unary_negation_on_record.elna
@@ -1,3 +1,5 @@
+module
+
type
R = record
x: Int
diff --git a/testsuite/fail_compilation/unary_plus_on_record.elna b/testsuite/fail_compilation/unary_plus_on_record.elna
index e1f6f4c..59485e3 100644
--- a/testsuite/fail_compilation/unary_plus_on_record.elna
+++ b/testsuite/fail_compilation/unary_plus_on_record.elna
@@ -1,3 +1,5 @@
+module
+
type
R = record
x: Int
diff --git a/testsuite/fail_compilation/varargs_argument.elna b/testsuite/fail_compilation/varargs_argument.elna
index 1325c29..b3b3459 100644
--- a/testsuite/fail_compilation/varargs_argument.elna
+++ b/testsuite/fail_compilation/varargs_argument.elna
@@ -1,12 +1,10 @@
+program()
var
written: Int32
proc printf(format: ^const Word8) #{varargs} -> Int32
extern
-program()
begin
written := printf("%s".ptr, "text") (* @Error Type '\[\]const Word8' cannot be passed as a variadic argument *)
-return 0u8
-
end.
diff --git a/testsuite/fail_compilation/varargs_attribute.elna b/testsuite/fail_compilation/varargs_attribute.elna
index 1c6d3e0..ec42710 100644
--- a/testsuite/fail_compilation/varargs_attribute.elna
+++ b/testsuite/fail_compilation/varargs_attribute.elna
@@ -1,5 +1,6 @@
+module
+
proc with_body(x: Int) #{varargs} (* @Error Attribute 'varargs' is not supported in this position *)
-begin
return
proc no_parameters() #{varargs} -> Int32 (* @Error Attribute 'varargs' requires at least one parameter *)
diff --git a/testsuite/fail_compilation/while_condition.elna b/testsuite/fail_compilation/while_condition.elna
index 0e4aa3c..bd54796 100644
--- a/testsuite/fail_compilation/while_condition.elna
+++ b/testsuite/fail_compilation/while_condition.elna
@@ -2,6 +2,4 @@ program()
begin
while 1 do (* @Error Condition must be a boolean expression, but got 'Int' *)
end
-return 0u8
-
end.
diff --git a/testsuite/runnable/aggregate_argument.elna b/testsuite/runnable/aggregate_argument.elna
index b36ccc3..7ae4947 100644
--- a/testsuite/runnable/aggregate_argument.elna
+++ b/testsuite/runnable/aggregate_argument.elna
@@ -1,3 +1,4 @@
+program()
type
R = record
a: Int;
@@ -7,9 +8,6 @@ type
proc f(r: R) -> Bool
return r.a = 1 & r.b = 2
-program()
begin
assert(f(R{a: 1, b: 2}))
-return 0u8
-
end.
diff --git a/testsuite/runnable/aggregate_equality.elna b/testsuite/runnable/aggregate_equality.elna
index be7b4f1..c9601f9 100644
--- a/testsuite/runnable/aggregate_equality.elna
+++ b/testsuite/runnable/aggregate_equality.elna
@@ -1,3 +1,4 @@
+program()
type
R = record
a: Int;
@@ -7,9 +8,6 @@ type
proc f() -> Bool
return R{a: 1, b: 2} = R{a: 1, b: 2}
-program()
begin
assert(f())
-return 0u8
-
end.
diff --git a/testsuite/runnable/aligned_attribute.elna b/testsuite/runnable/aligned_attribute.elna
index 45c0c37..e339faf 100644
--- a/testsuite/runnable/aligned_attribute.elna
+++ b/testsuite/runnable/aligned_attribute.elna
@@ -1,3 +1,4 @@
+program()
type
Plain = record
a: Word8;
@@ -23,7 +24,6 @@ var
first: ^Word8
second: ^Word8
-program()
begin
assert(#size(Plain) = 2u);
assert(#size(Spread) = 16u);
@@ -36,6 +36,4 @@ begin
first := @spread.a;
second := @spread.b;
assert(cast(second: Word) - cast(first: Word) = 8u)
-return 0u8
-
end.
diff --git a/testsuite/runnable/array_constructor.elna b/testsuite/runnable/array_constructor.elna
index 50d243a..fd22235 100644
--- a/testsuite/runnable/array_constructor.elna
+++ b/testsuite/runnable/array_constructor.elna
@@ -1,14 +1,12 @@
+program()
var
a: [3]Int := [1, 2, 3]
b: [2]Int := [4, 0]
-program()
begin
assert(a[1] = 1 & a[2] = 2 & a[3] = 3);
assert(b[1] = 4 & b[2] = 0);
a := [5, 6, 7];
assert(a[1] = 5 & a[2] = 6 & a[3] = 7)
-return 0u8
-
end.
diff --git a/testsuite/runnable/binary_literal.elna b/testsuite/runnable/binary_literal.elna
index 4f0fc97..6380f24 100644
--- a/testsuite/runnable/binary_literal.elna
+++ b/testsuite/runnable/binary_literal.elna
@@ -2,6 +2,4 @@ program()
begin
assert(0b11 = 3u);
assert(0B011 = 3u)
-return 0u8
-
end.
diff --git a/testsuite/runnable/block_local_variable.elna b/testsuite/runnable/block_local_variable.elna
index 6287eec..8d52b1c 100644
--- a/testsuite/runnable/block_local_variable.elna
+++ b/testsuite/runnable/block_local_variable.elna
@@ -1,6 +1,7 @@
program()
var
total: Int := 0
+
begin
if total = 0 then
var
@@ -9,6 +10,4 @@ begin
total := total + inner
end;
assert(total = 7)
-return 0u8
-
end.
diff --git a/testsuite/runnable/case_constant_label.elna b/testsuite/runnable/case_constant_label.elna
index 49fa2c2..1b01736 100644
--- a/testsuite/runnable/case_constant_label.elna
+++ b/testsuite/runnable/case_constant_label.elna
@@ -1,16 +1,14 @@
+program()
var
base: const Int := 2
limit: const Int := base
x: Int := 2
matched: Bool := false
-program()
begin
case x of
1: assert(false)
| limit: matched := true
end;
assert(matched)
-return 0u8
-
end.
diff --git a/testsuite/runnable/case_else.elna b/testsuite/runnable/case_else.elna
index 68330da..bc84069 100644
--- a/testsuite/runnable/case_else.elna
+++ b/testsuite/runnable/case_else.elna
@@ -1,8 +1,8 @@
+program()
var
x: Int := 5
matched: Bool := false
-program()
begin
case x of
1: assert(false)
@@ -12,6 +12,4 @@ begin
matched := true
end;
assert(matched)
-return 0u8
-
end.
diff --git a/testsuite/runnable/case_int.elna b/testsuite/runnable/case_int.elna
index 3a446d6..018018c 100644
--- a/testsuite/runnable/case_int.elna
+++ b/testsuite/runnable/case_int.elna
@@ -1,7 +1,7 @@
+program()
var
x: Int := 2
-program()
begin
case x of
1: assert(false)
@@ -10,6 +10,4 @@ begin
else
assert(false)
end
-return 0u8
-
end.
diff --git a/testsuite/runnable/case_multilabel.elna b/testsuite/runnable/case_multilabel.elna
index 3a042d2..44bb150 100644
--- a/testsuite/runnable/case_multilabel.elna
+++ b/testsuite/runnable/case_multilabel.elna
@@ -1,7 +1,7 @@
+program()
var
x: Int := 3
-program()
begin
case x of
1, 2, 3: assert(true)
@@ -9,6 +9,4 @@ begin
else
assert(false)
end
-return 0u8
-
end.
diff --git a/testsuite/runnable/case_record.elna b/testsuite/runnable/case_record.elna
index 25b3eb4..db8a6ff 100644
--- a/testsuite/runnable/case_record.elna
+++ b/testsuite/runnable/case_record.elna
@@ -1,3 +1,4 @@
+program()
type
R = record
a: Int;
@@ -7,7 +8,6 @@ type
var
r: R := R{a: 1, b: 2}
-program()
begin
case r of
R{a: 0, b: 0}: assert(false)
@@ -15,6 +15,4 @@ begin
else
assert(false)
end
-return 0u8
-
end.
diff --git a/testsuite/runnable/compile_time_array_access.elna b/testsuite/runnable/compile_time_array_access.elna
index 825e8d5..5ce10a0 100644
--- a/testsuite/runnable/compile_time_array_access.elna
+++ b/testsuite/runnable/compile_time_array_access.elna
@@ -1,10 +1,8 @@
+program()
var
array: const [3]Int := [1, 2, 3]
i: const Int := array[2]
-program()
begin
assert(i = 2)
-return 0u8
-
end.
diff --git a/testsuite/runnable/const_copy.elna b/testsuite/runnable/const_copy.elna
index fde423b..3b7cd1b 100644
--- a/testsuite/runnable/const_copy.elna
+++ b/testsuite/runnable/const_copy.elna
@@ -1,3 +1,4 @@
+program()
proc f()
var
x: const Int := 5
@@ -7,9 +8,6 @@ begin
assert(y = 5)
return
-program()
begin
f()
-return 0u8
-
end.
diff --git a/testsuite/runnable/const_initialization.elna b/testsuite/runnable/const_initialization.elna
index b388845..b4272f4 100644
--- a/testsuite/runnable/const_initialization.elna
+++ b/testsuite/runnable/const_initialization.elna
@@ -1,3 +1,4 @@
+program()
proc f()
var
x: const Int := 5
@@ -5,9 +6,6 @@ begin
assert(x = 5)
return
-program()
begin
f()
-return 0u8
-
end.
diff --git a/testsuite/runnable/constant_string_initializer.elna b/testsuite/runnable/constant_string_initializer.elna
index 0982373..b33b255 100644
--- a/testsuite/runnable/constant_string_initializer.elna
+++ b/testsuite/runnable/constant_string_initializer.elna
@@ -1,9 +1,7 @@
+program()
var
s: []const Word8 := "String value"
-program()
begin
assert(s = "String value")
-return 0u8
-
end.
diff --git a/testsuite/runnable/define_multiple_local_variables.elna b/testsuite/runnable/define_multiple_local_variables.elna
index bd4ba68..13bb357 100644
--- a/testsuite/runnable/define_multiple_local_variables.elna
+++ b/testsuite/runnable/define_multiple_local_variables.elna
@@ -1,11 +1,9 @@
+program()
proc f() -> Bool
var
a, b: Int := 5
return a = 5 & b = 5
-program()
begin
assert(f())
-return 0u8
-
end.
diff --git a/testsuite/runnable/exported_variable/helper.elna b/testsuite/runnable/exported_variable/helper.elna
index 23924be..4b2c9ba 100644
--- a/testsuite/runnable/exported_variable/helper.elna
+++ b/testsuite/runnable/exported_variable/helper.elna
@@ -1,3 +1,5 @@
+module
+
var
Shared*: Int := 42
diff --git a/testsuite/runnable/exported_variable/sut.elna b/testsuite/runnable/exported_variable/sut.elna
index 753293d..1d0449e 100644
--- a/testsuite/runnable/exported_variable/sut.elna
+++ b/testsuite/runnable/exported_variable/sut.elna
@@ -1,8 +1,6 @@
+program()
import helper
-program()
begin
assert(Shared = 42)
-return 0u8
-
end.
diff --git a/testsuite/runnable/fixed_int_max.elna b/testsuite/runnable/fixed_int_max.elna
index 7ccf2fb..f00fd60 100644
--- a/testsuite/runnable/fixed_int_max.elna
+++ b/testsuite/runnable/fixed_int_max.elna
@@ -4,6 +4,4 @@ begin
assert(#max(Int16) = 32767i16);
assert(#max(Int32) = 2147483647i32);
assert(#max(Int64) = 9223372036854775807i64)
-return 0u8
-
end.
diff --git a/testsuite/runnable/fixed_int_min.elna b/testsuite/runnable/fixed_int_min.elna
index f9522fd..fd6b110 100644
--- a/testsuite/runnable/fixed_int_min.elna
+++ b/testsuite/runnable/fixed_int_min.elna
@@ -4,6 +4,4 @@ begin
assert(#min(Int16) = -32768i16);
assert(#min(Int32) = -2147483648i32);
assert(#min(Int64) = -9223372036854775808i64)
-return 0u8
-
end.
diff --git a/testsuite/runnable/fixed_word_max.elna b/testsuite/runnable/fixed_word_max.elna
index 8fb8d27..c657614 100644
--- a/testsuite/runnable/fixed_word_max.elna
+++ b/testsuite/runnable/fixed_word_max.elna
@@ -4,6 +4,4 @@ begin
assert(#max(Word16) = 65535u16);
assert(#max(Word32) = 4294967295u32);
assert(#max(Word64) = 18446744073709551615u64)
-return 0u8
-
end.
diff --git a/testsuite/runnable/float_arithmetic.elna b/testsuite/runnable/float_arithmetic.elna
index e98a26d..f792b04 100644
--- a/testsuite/runnable/float_arithmetic.elna
+++ b/testsuite/runnable/float_arithmetic.elna
@@ -11,6 +11,4 @@ begin
assert(3.0f * 0.5f = 1.5f);
assert(1.0f / 4.0f = 0.25f);
assert(-3.14f < 0.0f)
-return 0u8
-
end.
diff --git a/testsuite/runnable/float_cast.elna b/testsuite/runnable/float_cast.elna
index 08d14c5..26cb0d2 100644
--- a/testsuite/runnable/float_cast.elna
+++ b/testsuite/runnable/float_cast.elna
@@ -1,12 +1,10 @@
+program()
var
folded: Int := cast(2.9: Int)
measure: Double := -2.9
-program()
begin
assert(folded = 2);
assert(cast(measure: Int) = -2);
assert(cast(folded: Double) = 2.0)
-return 0u8
-
end.
diff --git a/testsuite/runnable/for_call.elna b/testsuite/runnable/for_call.elna
index a2fcd06..6c72b38 100644
--- a/testsuite/runnable/for_call.elna
+++ b/testsuite/runnable/for_call.elna
@@ -1,3 +1,4 @@
+program()
var
actual: [2]Int := [0, 0]
@@ -6,12 +7,9 @@ begin
element^ := 1
return
-program()
begin
for x of actual do
set_element(x)
end;
assert(actual = [1, 1])
-return 0u8
-
end.
diff --git a/testsuite/runnable/for_defer.elna b/testsuite/runnable/for_defer.elna
index 04f0404..7a350a0 100644
--- a/testsuite/runnable/for_defer.elna
+++ b/testsuite/runnable/for_defer.elna
@@ -1,7 +1,7 @@
+program()
var
array: [2]Int := [0, 0]
-program()
begin
for x of array do
defer
@@ -9,6 +9,4 @@ begin
end
end;
assert(array = [1, 1])
-return 0u8
-
end.
diff --git a/testsuite/runnable/for_each_array.elna b/testsuite/runnable/for_each_array.elna
index 6eae577..5a754da 100644
--- a/testsuite/runnable/for_each_array.elna
+++ b/testsuite/runnable/for_each_array.elna
@@ -1,15 +1,13 @@
+program()
var
actual: [4]Word := [0u, 0u, 0u, 0u]
input: [4]Word := [2u, 4u, 6u, 8u]
i: Word := 1u
-program()
begin
for element of input do
actual[i] := element^ * 2u;
i := i + 1u
end;
assert(actual = [4u, 8u, 12u, 16u])
-return 0u8
-
end.
diff --git a/testsuite/runnable/for_each_slice.elna b/testsuite/runnable/for_each_slice.elna
index bfc8b44..31bc65a 100644
--- a/testsuite/runnable/for_each_slice.elna
+++ b/testsuite/runnable/for_each_slice.elna
@@ -1,10 +1,10 @@
+program()
var
actual: [4]Word := [0u, 0u, 0u, 0u]
input: [4]Word := [2u, 4u, 6u, 8u]
slice: []Word
i: Word := 1u
-program()
begin
slice := input[1u to input.length];
@@ -13,6 +13,4 @@ begin
i := i + 1u
end;
assert(actual = [4u, 8u, 12u, 16u])
-return 0u8
-
end.
diff --git a/testsuite/runnable/for_with.elna b/testsuite/runnable/for_with.elna
index 0859ed0..b3727f6 100644
--- a/testsuite/runnable/for_with.elna
+++ b/testsuite/runnable/for_with.elna
@@ -1,11 +1,10 @@
program()
var
actual: [3]Word := [0u, 0u, 0u]
+
begin
for element of [1u, 2u, 3u] with i do
actual[i] := i * element^
end;
assert(actual = [1u, 4u, 9u])
-return 0u8
-
end.
diff --git a/testsuite/runnable/generic_base.elna b/testsuite/runnable/generic_base.elna
index c36eccf..63737e0 100644
--- a/testsuite/runnable/generic_base.elna
+++ b/testsuite/runnable/generic_base.elna
@@ -1,3 +1,4 @@
+program()
type
File = record
fd: Int
@@ -29,7 +30,6 @@ begin
target^.tail := value
return
-program()
begin
seen := @jobs;
enqueue(@jobs, @f);
@@ -37,6 +37,4 @@ begin
assert(jobs.head = @f);
assert(jobs.tail = @f);
assert(#size(Queue#[^File]) = #size(Pointer) * 3u)
-return 0u8
-
end.
diff --git a/testsuite/runnable/generic_constructor.elna b/testsuite/runnable/generic_constructor.elna
index 201e1b1..d0a3f78 100644
--- a/testsuite/runnable/generic_constructor.elna
+++ b/testsuite/runnable/generic_constructor.elna
@@ -1,3 +1,4 @@
+program()
type
File = record
fd: Int
@@ -12,11 +13,8 @@ var
s: Stack#[^File]
f: File
-program()
begin
s := Stack#[^File]{ top: 1u, items: @f };
assert(s.top = 1u);
assert(s.items = @f)
-return 0u8
-
end.
diff --git a/testsuite/runnable/generic_erasure.elna b/testsuite/runnable/generic_erasure.elna
index eccc1d2..20862fa 100644
--- a/testsuite/runnable/generic_erasure.elna
+++ b/testsuite/runnable/generic_erasure.elna
@@ -1,3 +1,4 @@
+program()
type
File = record
fd: Int
@@ -18,7 +19,6 @@ begin
target^.held := value
return
-program()
begin
f.fd := 7;
b := 3u8;
@@ -26,6 +26,4 @@ begin
store#[^Word8](@bytes, @b);
assert(files.held^.fd = 7);
assert(bytes.held^ = 3u8)
-return 0u8
-
end.
diff --git a/testsuite/runnable/generic_pointer_arithmetic.elna b/testsuite/runnable/generic_pointer_arithmetic.elna
index fe1e197..209287d 100644
--- a/testsuite/runnable/generic_pointer_arithmetic.elna
+++ b/testsuite/runnable/generic_pointer_arithmetic.elna
@@ -1,16 +1,14 @@
+program()
var
base: [4]Int
element: ^Int
first: Pointer
second: Pointer
-program()
begin
element := base.ptr;
first := element;
second := first + 1;
assert(cast(second : Word) - cast(first : Word) = 1u);
assert(second - 1 = first)
-return 0u8
-
end.
diff --git a/testsuite/runnable/generic_record.elna b/testsuite/runnable/generic_record.elna
index 8a334ce..4164c3d 100644
--- a/testsuite/runnable/generic_record.elna
+++ b/testsuite/runnable/generic_record.elna
@@ -1,3 +1,4 @@
+program()
type
File = record
fd: Int
@@ -18,12 +19,9 @@ begin
target^.top := target^.top + 1u
return
-program()
begin
s.top := 0u;
push#[^File](@s, @f);
assert(s.top = 1u);
assert(s.items = @f)
-return 0u8
-
end.
diff --git a/testsuite/runnable/hexadecimal_literal.elna b/testsuite/runnable/hexadecimal_literal.elna
index 02bc4c5..a168bd2 100644
--- a/testsuite/runnable/hexadecimal_literal.elna
+++ b/testsuite/runnable/hexadecimal_literal.elna
@@ -2,6 +2,4 @@ program()
begin
assert(0xff = 255u);
assert(0X0f = 15u)
-return 0u8
-
end.
diff --git a/testsuite/runnable/multi_module/helper.elna b/testsuite/runnable/multi_module/helper.elna
index 5fd68af..c3c0bfd 100644
--- a/testsuite/runnable/multi_module/helper.elna
+++ b/testsuite/runnable/multi_module/helper.elna
@@ -1,3 +1,5 @@
+module
+
proc multiply*(x, y: Int) -> Int
return x * y
diff --git a/testsuite/runnable/multi_module/sut.elna b/testsuite/runnable/multi_module/sut.elna
index 5ad6860..4b6e176 100644
--- a/testsuite/runnable/multi_module/sut.elna
+++ b/testsuite/runnable/multi_module/sut.elna
@@ -1,8 +1,6 @@
+program()
import helper
-program()
begin
assert(multiply(3, 4) = 12)
-return 0u8
-
end.
diff --git a/testsuite/runnable/named_block.elna b/testsuite/runnable/named_block.elna
index a9c44ed..0ba7eff 100644
--- a/testsuite/runnable/named_block.elna
+++ b/testsuite/runnable/named_block.elna
@@ -1,7 +1,7 @@
+program()
var
counter: Int := 0
-program()
begin
block outer
while true do
@@ -13,6 +13,4 @@ begin
end
end;
assert(counter = 11)
-return 0u8
-
end.
diff --git a/testsuite/runnable/procedure_cast.elna b/testsuite/runnable/procedure_cast.elna
index 724fadf..191afbf 100644
--- a/testsuite/runnable/procedure_cast.elna
+++ b/testsuite/runnable/procedure_cast.elna
@@ -1,12 +1,11 @@
-var cb: proc(x: ^Char) -> Int
+program()
+var
+ cb: proc(x: ^Char) -> Int
proc probe_int(x: ^Int) -> Int
return 42
-program()
begin
cb := cast(probe_int: proc(x: ^Char) -> Int);
assert(cb(nil) = 42)
-return 0u8
-
end.
diff --git a/testsuite/runnable/record_base_assignment.elna b/testsuite/runnable/record_base_assignment.elna
index 5f84f20..7ad17e0 100644
--- a/testsuite/runnable/record_base_assignment.elna
+++ b/testsuite/runnable/record_base_assignment.elna
@@ -1,3 +1,4 @@
+program()
type
B = record
x: Word
@@ -16,9 +17,6 @@ begin
assert(r.x = 3u & r.y = 2u)
return
-program()
begin
f()
-return 0u8
-
end.
diff --git a/testsuite/runnable/record_base_constructor.elna b/testsuite/runnable/record_base_constructor.elna
index 52936e9..80b6802 100644
--- a/testsuite/runnable/record_base_constructor.elna
+++ b/testsuite/runnable/record_base_constructor.elna
@@ -1,3 +1,4 @@
+program()
type
Base = record
a: Int
@@ -12,11 +13,8 @@ type
var
g: Grandchild := Grandchild{a: 3, b: 5, c: 7}
-program()
begin
assert(g.a = 3);
assert(g.b = 5);
assert(g.c = 7)
-return 0u8
-
end.
diff --git a/testsuite/runnable/record_construction.elna b/testsuite/runnable/record_construction.elna
index ca99859..5a3a254 100644
--- a/testsuite/runnable/record_construction.elna
+++ b/testsuite/runnable/record_construction.elna
@@ -1,3 +1,4 @@
+program()
type
R = record
x, y: Int
@@ -6,9 +7,6 @@ type
var
r: R := R{x: 1, y: 2}
-program()
begin
assert(r.x = 1 & r.y = 2)
-return 0u8
-
end.
diff --git a/testsuite/runnable/record_extension.elna b/testsuite/runnable/record_extension.elna
index 5f61d60..95165f4 100644
--- a/testsuite/runnable/record_extension.elna
+++ b/testsuite/runnable/record_extension.elna
@@ -1,3 +1,4 @@
+program()
type
ElnaLexerToken = record
kind: Word
@@ -10,12 +11,9 @@ var
token_memory: ElnaLexerStringToken
current_token: ^ElnaLexerToken
-program()
begin
current_token := @token_memory;
cast(current_token: ^ElnaLexerStringToken)^.value := "Some string";
assert(token_memory.value = "Some string")
-return 0u8
-
end.
diff --git a/testsuite/runnable/record_layout.elna b/testsuite/runnable/record_layout.elna
index 6150a32..a3e64c4 100644
--- a/testsuite/runnable/record_layout.elna
+++ b/testsuite/runnable/record_layout.elna
@@ -1,3 +1,4 @@
+program()
type
IntChar = record
x: Int;
@@ -50,9 +51,6 @@ begin
assert(array_record_c_offset = 3u * int_size)
return
-program()
begin
f()
-return 0u8
-
end.
diff --git a/testsuite/runnable/recursive_record.elna b/testsuite/runnable/recursive_record.elna
index 5c59e64..48fb873 100644
--- a/testsuite/runnable/recursive_record.elna
+++ b/testsuite/runnable/recursive_record.elna
@@ -1,3 +1,4 @@
+program()
type
Node = record
value: Int;
@@ -27,7 +28,6 @@ begin
end;
return result
-program()
begin
first := malloc(#size(Node));
second := malloc(#size(Node));
@@ -46,6 +46,4 @@ begin
free(first);
free(second);
free(third)
-return 0u8
-
end.
diff --git a/testsuite/runnable/repeat_loop.elna b/testsuite/runnable/repeat_loop.elna
index 084b801..ff09735 100644
--- a/testsuite/runnable/repeat_loop.elna
+++ b/testsuite/runnable/repeat_loop.elna
@@ -1,14 +1,12 @@
+program()
var
actual: [4]Word := [0u, 0u, 0u, 0u]
i: Word := 0u
-program()
begin
repeat
i := i + 1u;
actual[i] := i
until i = 4u;
assert(actual = [1u, 2u, 3u, 4u])
-return 0u8
-
end.
diff --git a/testsuite/runnable/return_aggregate.elna b/testsuite/runnable/return_aggregate.elna
index 4377d94..6959b60 100644
--- a/testsuite/runnable/return_aggregate.elna
+++ b/testsuite/runnable/return_aggregate.elna
@@ -1,3 +1,4 @@
+program()
type
R = record
a: Int;
@@ -7,9 +8,6 @@ type
proc f() -> R
return R{ a: 1, b: 2 }
-program()
begin
assert(f() = R{ a: 1, b: 2 })
-return 0u8
-
end.
diff --git a/testsuite/runnable/slice_array.elna b/testsuite/runnable/slice_array.elna
index 7a889a3..4d7ad7e 100644
--- a/testsuite/runnable/slice_array.elna
+++ b/testsuite/runnable/slice_array.elna
@@ -1,14 +1,12 @@
+program()
var
array: [3]Int := [2, 4, 6]
slice: []Int
-program()
begin
slice := array[1 to 3];
assert(slice.length = 3u);
assert(slice[1] = 2);
assert(slice[3] = 6)
-return 0u8
-
end.
diff --git a/testsuite/runnable/slice_cast.elna b/testsuite/runnable/slice_cast.elna
index 0d4a861..d3309f9 100644
--- a/testsuite/runnable/slice_cast.elna
+++ b/testsuite/runnable/slice_cast.elna
@@ -1,9 +1,7 @@
+program()
var
ints: [4]Int32 := [1i32, 2i32, 3i32, 4i32]
-program()
begin
assert(cast(ints[1u to 4u]: []Int8).length = #size(Int32) * ints.length)
-return 0u8
-
end.
diff --git a/testsuite/runnable/slice_equality.elna b/testsuite/runnable/slice_equality.elna
index 1510f40..534afec 100644
--- a/testsuite/runnable/slice_equality.elna
+++ b/testsuite/runnable/slice_equality.elna
@@ -1,13 +1,11 @@
+program()
var
lhs_payload, rhs_payload: [3]Int := [2, 4, 6]
lhs, rhs: []Int
-program()
begin
lhs := lhs_payload[1 to 3];
rhs := rhs_payload[1 to 3];
assert(lhs = rhs)
-return 0u8
-
end.
diff --git a/testsuite/runnable/slice_pointer.elna b/testsuite/runnable/slice_pointer.elna
index c19e64a..150bda8 100644
--- a/testsuite/runnable/slice_pointer.elna
+++ b/testsuite/runnable/slice_pointer.elna
@@ -1,14 +1,12 @@
+program()
var
array: [3]Int := [2, 4, 6]
slice: []Int
-program()
begin
slice := array.ptr[1 to 3];
assert(slice.length = 3u);
assert(slice[1] = 2);
assert(slice[3] = 6)
-return 0u8
-
end.
diff --git a/testsuite/runnable/slice_slice.elna b/testsuite/runnable/slice_slice.elna
index fcfea8b..6395cea 100644
--- a/testsuite/runnable/slice_slice.elna
+++ b/testsuite/runnable/slice_slice.elna
@@ -1,8 +1,8 @@
+program()
var
array: [5]Int := [2, 4, 6, 8, 10]
slice1, slice2: []Int
-program()
begin
slice1 := array[1 to array.length];
slice2 := slice1[2 to 4];
@@ -11,6 +11,4 @@ begin
assert(slice2[1] = 4);
assert(slice2[2] = 6);
assert(slice2[3] = 8)
-return 0u8
-
end.
diff --git a/testsuite/runnable/two_fields_same_type.elna b/testsuite/runnable/two_fields_same_type.elna
index af591e4..2b905b6 100644
--- a/testsuite/runnable/two_fields_same_type.elna
+++ b/testsuite/runnable/two_fields_same_type.elna
@@ -1,3 +1,4 @@
+program()
type
R = record
x, y: Int
@@ -8,9 +9,6 @@ var
r: R := R{x: 3, y: 2}
return r.x + r.y
-program()
begin
assert(f() = 5)
-return 0u8
-
end.
diff --git a/testsuite/runnable/two_parameters_same_type.elna b/testsuite/runnable/two_parameters_same_type.elna
index 08a1b5a..18e3d63 100644
--- a/testsuite/runnable/two_parameters_same_type.elna
+++ b/testsuite/runnable/two_parameters_same_type.elna
@@ -1,9 +1,8 @@
+program()
+
proc f(x, y: Int) -> Int
return x + y
-program()
begin
assert(f(2, 3) = 5)
-return 0u8
-
end.
diff --git a/testsuite/runnable/unary_plus.elna b/testsuite/runnable/unary_plus.elna
index 7f331d4..4df6922 100644
--- a/testsuite/runnable/unary_plus.elna
+++ b/testsuite/runnable/unary_plus.elna
@@ -1,11 +1,10 @@
+program()
+
proc f(x: Int) -> Int
return +x
-program()
begin
assert(+3 = 3);
assert(f(5) = 5);
assert(f(-7) = -7)
-return 0u8
-
end.
diff --git a/testsuite/runnable/unicode_escape_character.elna b/testsuite/runnable/unicode_escape_character.elna
index f5a4b3f..0cfd3e2 100644
--- a/testsuite/runnable/unicode_escape_character.elna
+++ b/testsuite/runnable/unicode_escape_character.elna
@@ -2,6 +2,4 @@ program()
begin
assert(`\{U+E9}` = `é`);
assert(`\{U+1F600}` = `😀`)
-return 0u8
-
end.
diff --git a/testsuite/runnable/unicode_escape_string.elna b/testsuite/runnable/unicode_escape_string.elna
index 20be668..bec794a 100644
--- a/testsuite/runnable/unicode_escape_string.elna
+++ b/testsuite/runnable/unicode_escape_string.elna
@@ -2,6 +2,4 @@ program()
begin
assert("caf\{U+E9}" = "café");
assert("Hi \{U+1F600}!" = "Hi 😀!")
-return 0u8
-
end.
diff --git a/testsuite/runnable/varargs.elna b/testsuite/runnable/varargs.elna
index feeb94b..1bf16e9 100644
--- a/testsuite/runnable/varargs.elna
+++ b/testsuite/runnable/varargs.elna
@@ -1,3 +1,4 @@
+program()
var
buffer: [8]Word8
written: Int32
@@ -5,12 +6,9 @@ var
proc snprintf(buffer: ^Word8; size: Word; format: ^const Word8) #{varargs} -> Int32
extern
-program()
begin
written := snprintf(@buffer[1], 8u, "%d %.1f".ptr, 200u8, 1.5f);
assert(written = 7i32);
assert(buffer[1] = '2');
assert(buffer[7] = '5')
-return 0u8
-
end.