├── .github └── workflows │ └── test.yml ├── .gitignore ├── CONTRIBUTING.md ├── Cargo.toml ├── LICENSE.md ├── README.md ├── coverage.sh ├── examples ├── advanced_features.hay ├── fizzbuzz.hay ├── function.hay ├── generics.hay ├── hello.hay ├── interfaces.hay ├── loops_and_branching.hay ├── numbers_1.hay ├── numbers_2.hay ├── pointers.hay ├── user_defined_types.hay └── variable.hay ├── selfhost └── src │ ├── ast │ ├── arg │ │ ├── ident.hay │ │ └── untyped.hay │ ├── expr │ │ ├── accessor.hay │ │ ├── annotated_call.hay │ │ ├── as.hay │ │ ├── cast.hay │ │ ├── expr.hay │ │ ├── ident.hay │ │ ├── if.hay │ │ ├── literal.hay │ │ ├── operator.hay │ │ ├── return.hay │ │ ├── size_of.hay │ │ ├── syscall.hay │ │ ├── unary.hay │ │ ├── var.hay │ │ └── while.hay │ ├── member │ │ └── untyped.hay │ ├── stmt │ │ ├── enum.hay │ │ ├── function.hay │ │ ├── parser.hay │ │ ├── pre_declaration.hay │ │ ├── record.hay │ │ ├── stmt.hay │ │ └── var.hay │ └── visibility.hay │ ├── compiler │ └── compile.hay │ ├── error.hay │ ├── lex │ ├── keyword.hay │ ├── literal.hay │ ├── loc.hay │ ├── marker.hay │ ├── operator.hay │ ├── scanner.hay │ ├── token.hay │ ├── token_kind.hay │ └── type_token.hay │ ├── main.hay │ ├── types │ ├── function │ │ └── fn_tag.hay │ └── record │ │ └── record_kind.hay │ └── utils │ └── sets.hay ├── src ├── ast │ ├── arg.rs │ ├── expr │ │ ├── accessor.rs │ │ ├── annotated_call.rs │ │ ├── as.rs │ │ ├── block.rs │ │ ├── cast.rs │ │ ├── expr_typ.rs │ │ ├── ident.rs │ │ ├── if.rs │ │ ├── literal.rs │ │ ├── match.rs │ │ ├── mod.rs │ │ ├── never.rs │ │ ├── operator.rs │ │ ├── return.rs │ │ ├── size_of.rs │ │ ├── syscall.rs │ │ ├── tuple.rs │ │ ├── unary.rs │ │ ├── unpack.rs │ │ ├── var.rs │ │ └── while.rs │ ├── member.rs │ ├── mod.rs │ ├── parser.rs │ ├── stmt │ │ ├── enum.rs │ │ ├── function.rs │ │ ├── impl.rs │ │ ├── interface.rs │ │ ├── mod.rs │ │ ├── pre_decl.rs │ │ ├── record.rs │ │ ├── stmt_kind.rs │ │ ├── stmt_typ.rs │ │ ├── stub.rs │ │ └── var.rs │ └── visibility.rs ├── backend │ ├── instruction.rs │ ├── mod.rs │ └── x86_64_nasm.rs ├── compiler │ ├── mod.rs │ └── test_tools.rs ├── error.rs ├── lex │ ├── base.rs │ ├── mod.rs │ ├── scanner.rs │ └── token.rs ├── main.rs ├── tests │ ├── examples │ │ ├── advanced_features.try_com │ │ ├── advanced_features.try_run │ │ ├── fizzbuzz.try_com │ │ ├── fizzbuzz.try_run │ │ ├── function.try_com │ │ ├── function.try_run │ │ ├── generics.try_com │ │ ├── generics.try_run │ │ ├── hello.try_com │ │ ├── hello.try_run │ │ ├── interfaces.try_com │ │ ├── interfaces.try_run │ │ ├── loops_and_branching.try_com │ │ ├── loops_and_branching.try_run │ │ ├── numbers_1.try_com │ │ ├── numbers_1.try_run │ │ ├── numbers_2.try_com │ │ ├── numbers_2.try_run │ │ ├── pointers.try_com │ │ ├── pointers.try_run │ │ ├── user_defined_types.try_com │ │ ├── user_defined_types.try_run │ │ ├── variable.try_com │ │ └── variable.try_run │ ├── functional │ │ ├── address_of_framed.hay │ │ ├── address_of_framed.try_com │ │ ├── address_of_framed.try_run │ │ ├── address_of_union.hay │ │ ├── address_of_union.try_com │ │ ├── address_of_union.try_run │ │ ├── aliasing.hay │ │ ├── aliasing.try_com │ │ ├── aliasing.try_run │ │ ├── anonymous_structures.hay │ │ ├── anonymous_structures.try_com │ │ ├── anonymous_structures.try_run │ │ ├── array.hay │ │ ├── array.try_com │ │ ├── array.try_run │ │ ├── array_of_tuples.hay │ │ ├── array_of_tuples.try_com │ │ ├── array_of_tuples.try_run │ │ ├── associated_type_in_return.hay │ │ ├── associated_type_in_return.try_com │ │ ├── associated_type_in_return.try_run │ │ ├── blanket_impl.hay │ │ ├── blanket_impl.try_com │ │ ├── blanket_impl.try_run │ │ ├── blanket_impl_override.hay │ │ ├── blanket_impl_override.try_com │ │ ├── blanket_impl_override.try_run │ │ ├── cat.hay │ │ ├── cat.try_com │ │ ├── cat.try_run │ │ ├── concrete_sum_type.hay │ │ ├── concrete_sum_type.try_com │ │ ├── concrete_sum_type.try_run │ │ ├── early_return_basic.hay │ │ ├── early_return_basic.try_com │ │ ├── early_return_basic.try_run │ │ ├── early_return_if_else_while.hay │ │ ├── early_return_if_else_while.try_com │ │ ├── early_return_if_else_while.try_run │ │ ├── early_return_while_condition.hay │ │ ├── early_return_while_condition.try_com │ │ ├── early_return_while_condition.try_run │ │ ├── empty_string.hay │ │ ├── empty_string.try_com │ │ ├── empty_string.try_run │ │ ├── enum.hay │ │ ├── enum.try_com │ │ ├── enum.try_run │ │ ├── enum_struct_generic1.hay │ │ ├── enum_struct_generic1.try_com │ │ ├── enum_struct_generic1.try_run │ │ ├── enum_struct_generic2.hay │ │ ├── enum_struct_generic2.try_com │ │ ├── enum_struct_generic2.try_run │ │ ├── enum_struct_generic_else.hay │ │ ├── enum_struct_generic_else.try_com │ │ ├── enum_struct_generic_else.try_run │ │ ├── enum_struct_match_else_only.hay │ │ ├── enum_struct_match_else_only.try_com │ │ ├── enum_struct_match_else_only.try_run │ │ ├── enum_struct_match_nested.hay │ │ ├── enum_struct_match_nested.try_com │ │ ├── enum_struct_match_nested.try_run │ │ ├── enum_variants.hay │ │ ├── enum_variants.try_com │ │ ├── enum_variants.try_run │ │ ├── enum_variants_branching.hay │ │ ├── enum_variants_branching.try_com │ │ ├── enum_variants_branching.try_run │ │ ├── enum_variants_loop.hay │ │ ├── enum_variants_loop.try_com │ │ ├── enum_variants_loop.try_run │ │ ├── generic_fn_with_const_ptr_arg.hay │ │ ├── generic_fn_with_const_ptr_arg.try_com │ │ ├── generic_fn_with_const_ptr_arg.try_run │ │ ├── generic_pair_add.hay │ │ ├── generic_pair_add.try_com │ │ ├── generic_pair_add.try_run │ │ ├── generic_struct.hay │ │ ├── generic_struct.try_com │ │ ├── generic_struct.try_run │ │ ├── hello_world.hay │ │ ├── hello_world.try_com │ │ ├── hello_world.try_run │ │ ├── hstring.hay │ │ ├── hstring.try_com │ │ ├── hstring.try_run │ │ ├── if_else.hay │ │ ├── if_else.try_com │ │ ├── if_else.try_run │ │ ├── impl.hay │ │ ├── impl.try_com │ │ ├── impl.try_run │ │ ├── inline_fn.hay │ │ ├── inline_fn.try_com │ │ ├── inline_fn.try_run │ │ ├── inline_impl_fn.hay │ │ ├── inline_impl_fn.try_com │ │ ├── inline_impl_fn.try_run │ │ ├── inner_address_of_framed.hay │ │ ├── inner_address_of_framed.try_com │ │ ├── inner_address_of_framed.try_run │ │ ├── interface.hay │ │ ├── interface.try_com │ │ ├── interface.try_run │ │ ├── linear_map.hay │ │ ├── linear_map.try_com │ │ ├── linear_map.try_run │ │ ├── local.hay │ │ ├── local.try_com │ │ ├── local.try_run │ │ ├── match_on_variant.hay │ │ ├── match_on_variant.try_com │ │ ├── match_on_variant.try_run │ │ ├── math.hay │ │ ├── math.try_com │ │ ├── math.try_run │ │ ├── multiple_mutable_bindings.hay │ │ ├── multiple_mutable_bindings.try_com │ │ ├── multiple_mutable_bindings.try_run │ │ ├── mutable_fn_input.hay │ │ ├── mutable_fn_input.try_com │ │ ├── mutable_fn_input.try_run │ │ ├── nested_ident.hay │ │ ├── nested_ident.try_com │ │ ├── nested_ident.try_run │ │ ├── number_literal_bases.hay │ │ ├── number_literal_bases.try_com │ │ ├── number_literal_bases.try_run │ │ ├── option.hay │ │ ├── option.try_com │ │ ├── option.try_run │ │ ├── pointer.hay │ │ ├── pointer.try_com │ │ ├── pointer.try_run │ │ ├── pointer_offsets.hay │ │ ├── pointer_offsets.try_com │ │ ├── pointer_offsets.try_run │ │ ├── pointer_types.hay │ │ ├── pointer_types.try_com │ │ ├── pointer_types.try_run │ │ ├── pre_declare.hay │ │ ├── pre_declare.try_com │ │ ├── print_to_string_fmt.hay │ │ ├── print_to_string_fmt.try_com │ │ ├── print_to_string_fmt.try_run │ │ ├── result.hay │ │ ├── result.try_com │ │ ├── result.try_run │ │ ├── struct.hay │ │ ├── struct.try_com │ │ ├── struct.try_run │ │ ├── struct_accessors.hay │ │ ├── struct_accessors.try_com │ │ ├── struct_accessors.try_run │ │ ├── tuple_accessors_unary.hay │ │ ├── tuple_accessors_unary.try_com │ │ ├── tuple_accessors_unary.try_run │ │ ├── tuple_destructure.hay │ │ ├── tuple_destructure.try_com │ │ ├── tuple_destructure.try_run │ │ ├── tuple_expressions.hay │ │ ├── tuple_expressions.try_com │ │ ├── tuple_expressions.try_run │ │ ├── tuple_expressions2.hay │ │ ├── tuple_expressions2.try_com │ │ ├── tuple_expressions2.try_run │ │ ├── tuple_printing.hay │ │ ├── tuple_printing.try_com │ │ ├── tuple_printing.try_run │ │ ├── union.hay │ │ ├── union.try_com │ │ ├── union.try_run │ │ ├── unpack_tuple.hay │ │ ├── unpack_tuple.try_com │ │ ├── unpack_tuple.try_run │ │ ├── valid_pointer_operations.hay │ │ ├── valid_pointer_operations.try_com │ │ ├── valid_pointer_operations.try_run │ │ ├── vec.hay │ │ ├── vec.try_com │ │ ├── vec.try_run │ │ ├── vec_formatting.hay │ │ ├── vec_formatting.try_com │ │ ├── vec_formatting.try_run │ │ ├── zero_sized_type_pointer_ops.hay │ │ ├── zero_sized_type_pointer_ops.try_com │ │ └── zero_sized_type_pointer_ops.try_run │ ├── parser │ │ ├── anon_struct_bad_close.hay │ │ ├── anon_struct_bad_close.try_com │ │ ├── parse_as_block_bad_close.hay │ │ ├── parse_as_block_bad_close.try_com │ │ ├── parse_as_block_bad_destructure_close.hay │ │ ├── parse_as_block_bad_destructure_close.try_com │ │ ├── parse_as_block_bad_open.hay │ │ ├── parse_as_block_bad_open.try_com │ │ ├── parse_as_block_empty_destructure.hay │ │ ├── parse_as_block_empty_destructure.try_com │ │ ├── parse_bad_accessor1.hay │ │ ├── parse_bad_accessor1.try_com │ │ ├── parse_bad_accessor2.hay │ │ ├── parse_bad_accessor2.try_com │ │ ├── parse_bad_accessor3.hay │ │ ├── parse_bad_accessor3.try_com │ │ ├── parse_bad_annotated_call_close.hay │ │ ├── parse_bad_annotated_call_close.try_com │ │ ├── parse_bad_annotated_type.hay │ │ ├── parse_bad_annotated_type.try_com │ │ ├── parse_bad_arg_identifier.hay │ │ ├── parse_bad_arg_identifier.try_com │ │ ├── parse_bad_array_var_close.hay │ │ ├── parse_bad_array_var_close.try_com │ │ ├── parse_bad_array_var_size.hay │ │ ├── parse_bad_array_var_size.try_com │ │ ├── parse_bad_block_close.hay │ │ ├── parse_bad_block_close.try_com │ │ ├── parse_bad_block_open.hay │ │ ├── parse_bad_block_open.try_com │ │ ├── parse_bad_body_after_function_name.hay │ │ ├── parse_bad_body_after_function_name.try_com │ │ ├── parse_bad_cast_expr_close.hay │ │ ├── parse_bad_cast_expr_close.try_com │ │ ├── parse_bad_cast_expr_open.hay │ │ ├── parse_bad_cast_expr_open.try_com │ │ ├── parse_bad_cast_expr_param.hay │ │ ├── parse_bad_cast_expr_param.try_com │ │ ├── parse_bad_const_ptr_type.hay │ │ ├── parse_bad_const_ptr_type.try_com │ │ ├── parse_bad_else_if_block.hay │ │ ├── parse_bad_else_if_block.try_com │ │ ├── parse_bad_expression.hay │ │ ├── parse_bad_expression.try_com │ │ ├── parse_bad_file_to_include.hay │ │ ├── parse_bad_file_to_include.try_com │ │ ├── parse_bad_follow_up_to_inline.hay │ │ ├── parse_bad_follow_up_to_inline.try_com │ │ ├── parse_bad_function_annotation_close.hay │ │ ├── parse_bad_function_annotation_close.try_com │ │ ├── parse_bad_function_parameter_close.hay │ │ ├── parse_bad_function_parameter_close.try_com │ │ ├── parse_bad_function_return_list_close.hay │ │ ├── parse_bad_function_return_list_close.try_com │ │ ├── parse_bad_function_return_list_open.hay │ │ ├── parse_bad_function_return_list_open.try_com │ │ ├── parse_bad_generic_impl_close.hay │ │ ├── parse_bad_generic_impl_close.try_com │ │ ├── parse_bad_generic_impl_requires.hay │ │ ├── parse_bad_generic_impl_requires.try_com │ │ ├── parse_bad_include_statement.hay │ │ ├── parse_bad_include_statement.try_com │ │ ├── parse_bad_inner_address_of.hay │ │ ├── parse_bad_inner_address_of.try_com │ │ ├── parse_bad_interface_annotation_close.hay │ │ ├── parse_bad_interface_annotation_close.try_com │ │ ├── parse_bad_interface_annotation_open.hay │ │ ├── parse_bad_interface_annotation_open.try_com │ │ ├── parse_bad_interface_associated_type.hay │ │ ├── parse_bad_interface_associated_type.try_com │ │ ├── parse_bad_interface_associated_type_name.hay │ │ ├── parse_bad_interface_associated_type_name.try_com │ │ ├── parse_bad_interface_associated_type_placeholder.hay │ │ ├── parse_bad_interface_associated_type_placeholder.try_com │ │ ├── parse_bad_interface_body_close.hay │ │ ├── parse_bad_interface_body_close.try_com │ │ ├── parse_bad_interface_body_open.hay │ │ ├── parse_bad_interface_body_open.try_com │ │ ├── parse_bad_interface_impl_close.hay │ │ ├── parse_bad_interface_impl_close.try_com │ │ ├── parse_bad_interface_impl_open.hay │ │ ├── parse_bad_interface_impl_open.try_com │ │ ├── parse_bad_interface_impl_type.hay │ │ ├── parse_bad_interface_impl_type.try_com │ │ ├── parse_bad_interface_name.hay │ │ ├── parse_bad_interface_name.try_com │ │ ├── parse_bad_on_copy_name.hay │ │ ├── parse_bad_on_copy_name.try_com │ │ ├── parse_bad_on_drop_name.hay │ │ ├── parse_bad_on_drop_name.try_com │ │ ├── parse_bad_pointer_type.hay │ │ ├── parse_bad_pointer_type.try_com │ │ ├── parse_bad_requirement_close.hay │ │ ├── parse_bad_requirement_close.try_com │ │ ├── parse_bad_requirement_list.hay │ │ ├── parse_bad_requirement_list.try_com │ │ ├── parse_bad_requirement_open.hay │ │ ├── parse_bad_requirement_open.try_com │ │ ├── parse_bad_requirement_start.hay │ │ ├── parse_bad_requirement_start.try_com │ │ ├── parse_bad_sizeof_close.hay │ │ ├── parse_bad_sizeof_close.try_com │ │ ├── parse_bad_sizeof_open.hay │ │ ├── parse_bad_sizeof_open.try_com │ │ ├── parse_bad_sizeof_operand.hay │ │ ├── parse_bad_sizeof_operand.try_com │ │ ├── parse_bad_sizeof_param.hay │ │ ├── parse_bad_sizeof_param.try_com │ │ ├── parse_bad_top_level_token.hay │ │ ├── parse_bad_top_level_token.try_com │ │ ├── parse_bad_tuple_expression_close.hay │ │ ├── parse_bad_tuple_expression_close.try_com │ │ ├── parse_enum_bad_close.hay │ │ ├── parse_enum_bad_close.try_com │ │ ├── parse_enum_bad_open.hay │ │ ├── parse_enum_bad_open.try_com │ │ ├── parse_enum_empty_variants.hay │ │ ├── parse_enum_empty_variants.try_com │ │ ├── parse_enum_without_identifier.hay │ │ ├── parse_enum_without_identifier.try_com │ │ ├── parse_function_empty_return_list.hay │ │ ├── parse_function_empty_return_list.try_com │ │ ├── parse_function_without_name.hay │ │ ├── parse_function_without_name.try_com │ │ ├── parse_match_as_too_many_args.hay │ │ ├── parse_match_as_too_many_args.try_com │ │ ├── parse_match_bad_as_close.hay │ │ ├── parse_match_bad_as_close.try_com │ │ ├── parse_match_bad_as_open.hay │ │ ├── parse_match_bad_as_open.try_com │ │ ├── parse_match_bad_close.hay │ │ ├── parse_match_bad_close.try_com │ │ ├── parse_match_bad_open.hay │ │ ├── parse_match_bad_open.try_com │ │ ├── parse_missing_mutable_ident_in_as.hay │ │ ├── parse_missing_mutable_ident_in_as.try_com │ │ ├── parse_mixed_identifier_arg_list.hay │ │ ├── parse_mixed_identifier_arg_list.try_com │ │ ├── parse_mut_in_fn_output.hay │ │ ├── parse_mut_in_fn_output.try_com │ │ ├── parse_named_args_in_return_list.hay │ │ ├── parse_no_args_in_annotated_call.hay │ │ ├── parse_no_args_in_annotated_call.try_com │ │ ├── parse_on_copy_outside_impl.hay │ │ ├── parse_on_copy_outside_impl.try_com │ │ ├── parse_on_drop_outside_impl.hay │ │ ├── parse_on_drop_outside_impl.try_com │ │ ├── parse_partially_named_args.hay │ │ ├── parse_partially_named_args.try_com │ │ ├── parse_pub_in_union.hay │ │ ├── parse_pub_in_union.try_com │ │ ├── parse_recursive_type.hay │ │ ├── parse_recursive_type.try_com │ │ ├── parse_struct_bad_annotations_close.hay │ │ ├── parse_struct_bad_annotations_close.try_com │ │ ├── parse_struct_bad_close.hay │ │ ├── parse_struct_bad_close.try_com │ │ ├── parse_struct_bad_impl_open.hay │ │ ├── parse_struct_bad_impl_open.try_com │ │ ├── parse_struct_bad_open.hay │ │ ├── parse_struct_bad_open.try_com │ │ ├── parse_struct_empty_members.hay │ │ ├── parse_struct_empty_members.try_com │ │ ├── parse_struct_member_without_identifier1.hay │ │ ├── parse_struct_member_without_identifier1.try_com │ │ ├── parse_struct_member_without_identifier2.hay │ │ ├── parse_struct_member_without_identifier2.try_com │ │ ├── parse_struct_pub_member_without_type.hay │ │ ├── parse_struct_pub_member_without_type.try_com │ │ ├── parse_struct_without_identifier.hay │ │ ├── parse_struct_without_identifier.try_com │ │ ├── parse_tuple_bad_close.hay │ │ ├── parse_tuple_bad_close.try_com │ │ ├── parse_tuple_empty.hay │ │ ├── parse_tuple_empty.try_com │ │ ├── parse_tuple_empty.try_run │ │ ├── parse_type_missing_associated_type_identifier.hay │ │ ├── parse_type_missing_associated_type_identifier.try_com │ │ ├── parse_var_expr_bad_ident.hay │ │ ├── parse_var_expr_bad_ident.try_com │ │ ├── parse_var_expr_bad_type.hay │ │ ├── parse_var_expr_bad_type.try_com │ │ ├── parse_var_expr_missing_colon.hay │ │ ├── parse_var_expr_missing_colon.try_com │ │ ├── parse_while_without_do.hay │ │ └── parse_while_without_do.try_com │ ├── scanner │ │ ├── scan_bad_equals_operator.hay │ │ ├── scan_bad_equals_operator.try_com │ │ ├── scan_bad_escaped_char.hay │ │ ├── scan_bad_escaped_char.try_com │ │ ├── scan_bad_number_literal.hay │ │ ├── scan_bad_number_literal.try_com │ │ ├── scan_bad_syscall_close.hay │ │ ├── scan_bad_syscall_close.try_com │ │ ├── scan_bad_syscall_number_too_large.hay │ │ ├── scan_bad_syscall_number_too_large.try_com │ │ ├── scan_bad_syscall_number_too_small.hay │ │ ├── scan_bad_syscall_number_too_small.try_com │ │ ├── scan_bad_syscall_open.hay │ │ ├── scan_bad_syscall_open.try_com │ │ ├── scan_bad_syscall_parameter.hay │ │ ├── scan_bad_syscall_parameter.try_com │ │ ├── scan_bad_u8.hay │ │ ├── scan_bad_u8.try_com │ │ ├── scan_good_escape_chars.hay │ │ ├── scan_good_escape_chars.try_com │ │ ├── scan_multi_line_string.hay │ │ ├── scan_multi_line_string.try_com │ │ ├── scan_special_functions.hay │ │ ├── scan_special_functions.try_com │ │ ├── scan_unexpected_char.hay │ │ ├── scan_unexpected_char.try_com │ │ ├── scan_unterminated_char.hay │ │ ├── scan_unterminated_char.try_com │ │ ├── scan_unterminated_string.hay │ │ └── scan_unterminated_string.try_com │ ├── stmt │ │ ├── associated_type_redefinition.hay │ │ ├── associated_type_redefinition.try_com │ │ ├── bad_associated_type.hay │ │ ├── bad_associated_type.try_com │ │ ├── blanket_impl_requirement_breach.hay │ │ ├── blanket_impl_requirement_breach.try_com │ │ ├── dangling_pre_declaration.hay │ │ ├── dangling_pre_declaration.try_com │ │ ├── enum_name_conflict.hay │ │ ├── enum_name_conflict.try_com │ │ ├── fn_name_conflict.hay │ │ ├── fn_name_conflict.try_com │ │ ├── funcion_non_interface_requirement1.hay │ │ ├── funcion_non_interface_requirement1.try_com │ │ ├── funcion_non_interface_requirement2.hay │ │ ├── funcion_non_interface_requirement2.try_com │ │ ├── impl_non_interface_type.hay │ │ ├── impl_non_interface_type.try_com │ │ ├── impl_unknown_interface.hay │ │ ├── impl_unknown_interface.try_com │ │ ├── impl_wrong_annotations.hay │ │ ├── impl_wrong_annotations.try_com │ │ ├── interface_name_conflict.hay │ │ ├── interface_name_conflict.try_com │ │ ├── interface_non_interface_requirement1.hay │ │ ├── interface_non_interface_requirement1.try_com │ │ ├── interface_non_interface_requirement2.hay │ │ ├── interface_non_interface_requirement2.try_com │ │ ├── interface_reimpl.hay │ │ ├── interface_reimpl.try_com │ │ ├── interface_requirements.hay │ │ ├── interface_requirements.try_com │ │ ├── interface_signature_mismatch.hay │ │ ├── interface_signature_mismatch.try_com │ │ ├── missing_associated_types.hay │ │ ├── missing_associated_types.try_com │ │ ├── missing_interface_impls.hay │ │ ├── missing_interface_impls.try_com │ │ ├── non_generic_function_requirements.hay │ │ ├── non_generic_function_requirements.try_com │ │ ├── non_generic_record_requirements.hay │ │ ├── non_generic_record_requirements.try_com │ │ ├── pre_decl_name_conflict.hay │ │ ├── pre_decl_name_conflict.try_com │ │ ├── pre_declare_generics_mismatch.hay │ │ ├── pre_declare_generics_mismatch.try_com │ │ ├── pre_declare_generics_mismatch2.hay │ │ ├── pre_declare_generics_mismatch2.try_com │ │ ├── pre_declare_generics_mismatch3.hay │ │ ├── pre_declare_generics_mismatch3.try_com │ │ ├── pre_declare_generics_mismatch4.hay │ │ ├── pre_declare_generics_mismatch4.try_com │ │ ├── pre_declare_kind_mismatch.hay │ │ ├── pre_declare_kind_mismatch.try_com │ │ ├── pre_declare_kind_mismatch2.hay │ │ ├── pre_declare_kind_mismatch2.try_com │ │ ├── record_name_conflict.hay │ │ ├── record_name_conflict.try_com │ │ ├── record_non_interface_requirement1.hay │ │ ├── record_non_interface_requirement1.try_com │ │ ├── record_non_interface_requirement2.hay │ │ ├── record_non_interface_requirement2.try_com │ │ ├── unexpected_interface_function.hay │ │ ├── unexpected_interface_function.try_com │ │ ├── var_name_conflict.hay │ │ └── var_name_conflict.try_com │ └── type_check │ │ ├── address_of_unknown_ident.hay │ │ ├── address_of_unknown_ident.try_com │ │ ├── annotated_unknown_function_call.hay │ │ ├── annotated_unknown_function_call.try_com │ │ ├── annotations_on_non_generic_function.hay │ │ ├── annotations_on_non_generic_function.try_com │ │ ├── anon_struct_bad_accessor1.hay │ │ ├── anon_struct_bad_accessor1.try_com │ │ ├── anon_struct_bad_accessor2.hay │ │ ├── anon_struct_bad_accessor2.try_com │ │ ├── associated_type_unknown_interface.hay │ │ ├── associated_type_unknown_interface.try_com │ │ ├── associated_types.hay │ │ ├── associated_types.try_com │ │ ├── associated_types_no_impl.hay │ │ ├── associated_types_no_impl.try_com │ │ ├── bad_early_return.hay │ │ ├── bad_early_return.try_com │ │ ├── bad_interface_resolution.hay │ │ ├── bad_interface_resolution.try_com │ │ ├── bind_insufficient_elements.hay │ │ ├── bind_insufficient_elements.try_com │ │ ├── cast_enum.hay │ │ ├── cast_enum.try_com │ │ ├── cast_enum_struct.hay │ │ ├── cast_enum_struct.try_com │ │ ├── cast_enum_struct_generic.hay │ │ ├── cast_enum_struct_generic.try_com │ │ ├── cast_generic_struct_instance.hay │ │ ├── cast_generic_struct_instance.try_com │ │ ├── cast_to_generic_struct_with_private_members.hay │ │ ├── cast_to_generic_struct_with_private_members.try_com │ │ ├── cast_to_generic_struct_with_private_members_in_impl.hay │ │ ├── cast_to_generic_struct_with_private_members_in_impl.try_com │ │ ├── cast_to_generic_union.hay │ │ ├── cast_to_generic_union.try_com │ │ ├── cast_to_generic_union.try_run │ │ ├── cast_to_struct_with_private_members.hay │ │ ├── cast_to_struct_with_private_members.try_com │ │ ├── cast_to_struct_with_private_members_in_impl.hay │ │ ├── cast_to_struct_with_private_members_in_impl.try_com │ │ ├── cast_u8.hay │ │ ├── cast_u8.try_com │ │ ├── cast_u8.try_run │ │ ├── cast_variant.hay │ │ ├── cast_variant.try_com │ │ ├── destructure_non_tuple.hay │ │ ├── destructure_non_tuple.try_com │ │ ├── destructure_wrong_number_idents.hay │ │ ├── destructure_wrong_number_idents.try_com │ │ ├── enum_bad_variant.hay │ │ ├── enum_bad_variant.try_com │ │ ├── enum_bad_variant2.hay │ │ ├── enum_bad_variant2.try_com │ │ ├── enum_compare.hay │ │ ├── enum_compare.try_com │ │ ├── enum_enum_resolution.hay │ │ ├── enum_enum_resolution.try_com │ │ ├── enum_multiple_inner_access.hay │ │ ├── enum_multiple_inner_access.try_com │ │ ├── enum_struct_generic_base_fn_sig.hay │ │ ├── enum_struct_generic_base_fn_sig.try_com │ │ ├── enum_struct_multiple_inner.hay │ │ ├── enum_struct_multiple_inner.try_com │ │ ├── enum_struct_require_cast.hay │ │ ├── enum_struct_require_cast.try_com │ │ ├── enum_struct_require_generics.hay │ │ ├── enum_struct_require_generics.try_com │ │ ├── enum_struct_unknown_variant.hay │ │ ├── enum_struct_unknown_variant.try_com │ │ ├── enum_unknown_variant.hay │ │ ├── enum_unknown_variant.try_com │ │ ├── function_requirements.hay │ │ ├── function_requirements.try_com │ │ ├── generic_record_record_resolution.hay │ │ ├── generic_record_record_resolution.try_com │ │ ├── generic_record_size.hay │ │ ├── generic_record_size.try_com │ │ ├── if_block_different_stacks.hay │ │ ├── if_block_different_stacks.try_com │ │ ├── if_else_push_between_conditions.hay │ │ ├── if_else_push_between_conditions.try_com │ │ ├── if_no_else_modify_stack.hay │ │ ├── if_no_else_modify_stack.try_com │ │ ├── immutable_pointer_write.hay │ │ ├── immutable_pointer_write.try_com │ │ ├── incorrect_fn_signature.hay │ │ ├── incorrect_fn_signature.try_com │ │ ├── inner_address_of_no_member.hay │ │ ├── inner_address_of_no_member.try_com │ │ ├── inner_address_of_non_record_type.hay │ │ ├── inner_address_of_non_record_type.try_com │ │ ├── inner_address_of_private_member.hay │ │ ├── inner_address_of_private_member.try_com │ │ ├── inner_address_of_private_member_in_impl.hay │ │ ├── inner_address_of_private_member_in_impl.try_com │ │ ├── interface_instance_concrete.hay │ │ ├── interface_instance_concrete.try_com │ │ ├── interface_instance_generic.hay │ │ ├── interface_instance_generic.try_com │ │ ├── match_bad_type.hay │ │ ├── match_bad_type.try_com │ │ ├── match_else_case.hay │ │ ├── match_else_case.try_com │ │ ├── match_empty.hay │ │ ├── match_empty.try_com │ │ ├── match_empty_stack.hay │ │ ├── match_empty_stack.try_com │ │ ├── match_mismatched_bases.hay │ │ ├── match_mismatched_bases.try_com │ │ ├── match_non_exhaustive.hay │ │ ├── match_non_exhaustive.try_com │ │ ├── match_non_variant_case.hay │ │ ├── match_non_variant_case.try_com │ │ ├── match_unknown_type_case.hay │ │ ├── match_unknown_type_case.try_com │ │ ├── multiple_pointer_offsets.hay │ │ ├── multiple_pointer_offsets.try_com │ │ ├── mutable_pointer_to_immutable_fn_arg.hay │ │ ├── mutable_pointer_to_immutable_fn_arg.try_com │ │ ├── mutable_pointer_to_immutable_framed.hay │ │ ├── mutable_pointer_to_immutable_framed.try_com │ │ ├── mutable_pointer_to_immutable_framed_inner.hay │ │ ├── mutable_pointer_to_immutable_framed_inner.try_com │ │ ├── never_type.hay │ │ ├── never_type.try_com │ │ ├── never_type_input.hay │ │ ├── never_type_input.try_com │ │ ├── non_record_accessor.hay │ │ ├── non_record_accessor.try_com │ │ ├── ops_after_return.hay │ │ ├── ops_after_return.try_com │ │ ├── pointer_supertype_resolution.hay │ │ ├── pointer_supertype_resolution.try_com │ │ ├── private_member_access.hay │ │ ├── private_member_access.try_com │ │ ├── private_member_access_in_impl.hay │ │ ├── private_member_access_in_impl.try_com │ │ ├── record_record_resolution.hay │ │ ├── record_record_resolution.try_com │ │ ├── size_of_unknown_type.hay │ │ ├── size_of_unknown_type.try_com │ │ ├── size_of_unknown_type_generic.hay │ │ ├── size_of_unknown_type_generic.try_com │ │ ├── struct_accessor_without_member.hay │ │ ├── struct_accessor_without_member.try_com │ │ ├── struct_requirements.hay │ │ ├── struct_requirements.try_com │ │ ├── syscall_bad_number_of_args.hay │ │ ├── syscall_bad_number_of_args.try_com │ │ ├── syscall_wrong_sized_types.hay │ │ ├── syscall_wrong_sized_types.try_com │ │ ├── union_accessor_without_member.hay │ │ ├── union_accessor_without_member.try_com │ │ ├── union_requirements.hay │ │ ├── union_requirements.try_com │ │ ├── unknown_accessor_ident.hay │ │ ├── unknown_accessor_ident.try_com │ │ ├── unknown_associated_type.hay │ │ ├── unknown_associated_type.try_com │ │ ├── unpack_empty_stack.hay │ │ ├── unpack_empty_stack.try_com │ │ ├── unpack_non_tuple.hay │ │ ├── unpack_non_tuple.try_com │ │ ├── unrecognized_ident.hay │ │ ├── unrecognized_ident.try_com │ │ ├── unresolved_generics_in_annotated_call.hay │ │ ├── unresolved_generics_in_annotated_call.try_com │ │ ├── var_unknown_type.hay │ │ ├── var_unknown_type.try_com │ │ ├── variant_bad_resolve.hay │ │ ├── variant_bad_resolve.try_com │ │ ├── variant_resolve_bad_bases.hay │ │ ├── variant_resolve_bad_bases.try_com │ │ ├── variant_resolve_bad_variant.hay │ │ ├── variant_resolve_bad_variant.try_com │ │ ├── while_changes_frame.hay │ │ ├── while_changes_frame.try_com │ │ ├── while_changes_stack.hay │ │ ├── while_changes_stack.try_com │ │ ├── while_loop_push_before_condition.hay │ │ └── while_loop_push_before_condition.try_com └── types │ ├── framed_type.rs │ ├── function.rs │ ├── interface │ ├── associated_type.rs │ ├── base.rs │ ├── instance.rs │ └── mod.rs │ ├── mod.rs │ ├── record_kind.rs │ ├── signature.rs │ ├── type.rs │ ├── type_id.rs │ ├── variance.rs │ └── variant.rs └── std ├── alloc.hay ├── arr.hay ├── assert.hay ├── builtin ├── bool.hay ├── char.hay ├── prelude.hay ├── ptr.hay ├── u64.hay └── u8.hay ├── const_arr.hay ├── file.hay ├── fmt ├── fmt.hay ├── prelude.hay ├── to_string.hay └── write.hay ├── linear_map.hay ├── ops ├── add.hay ├── bit_and.hay ├── bit_or.hay ├── bit_xor.hay ├── div.hay ├── mul.hay ├── prelude.hay ├── shl.hay ├── shr.hay └── sub.hay ├── option.hay ├── prelude.hay ├── print.hay ├── result.hay ├── str.hay ├── string.hay ├── sys ├── prelude.hay └── x86_64.hay └── vec.hay /.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !/**/ 3 | !*.* 4 | *.json 5 | Cargo.lock 6 | /target 7 | *.o 8 | *.asm 9 | *.out 10 | *.simple 11 | 12 | 13 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "haystack" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | serde = { version = "1.0", features = ["derive"] } 10 | serde_json = "1.0.79" 11 | clap = { version = "3.1", features = ["derive"] } -------------------------------------------------------------------------------- /coverage.sh: -------------------------------------------------------------------------------- 1 | rm -rf target/coverage 2 | mkdir target/coverage 3 | mkdir target/coverage/html 4 | 5 | CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='target/coverage/cargo-test-%p-%m.profraw' cargo test 6 | grcov . --binary-path ./target/debug/deps/ -s . -t html --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/html -------------------------------------------------------------------------------- /examples/hello.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | "Hello World!" // Pushes the string literal onto the stack 3 | println // Calls the `println` function and prints the string. 4 | } -------------------------------------------------------------------------------- /examples/numbers_2.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 1 2 + 3 4 5 + * + println 3 | } -------------------------------------------------------------------------------- /examples/variable.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 1 2 as [one two] { 3 | one println 4 | two println 5 | two println 6 | one println 7 | } 8 | // one -- uncomment this to see the compiler error 9 | } -------------------------------------------------------------------------------- /selfhost/src/ast/arg/ident.hay: -------------------------------------------------------------------------------- 1 | include "selfhost/src/lex/token.hay" 2 | include "opt.hay" 3 | 4 | struct IdentArg { 5 | pub Token: token 6 | pub Opt: mutable 7 | } -------------------------------------------------------------------------------- /selfhost/src/ast/arg/untyped.hay: -------------------------------------------------------------------------------- 1 | include "selfhost/src/lex/token.hay" 2 | include "opt.hay" 3 | 4 | struct UntypedArg { 5 | pub Token: token 6 | pub Opt: mutable 7 | pub Opt: ident 8 | } -------------------------------------------------------------------------------- /selfhost/src/ast/expr/accessor.hay: -------------------------------------------------------------------------------- 1 | include "vec.hay" 2 | include "selfhost/src/lex/token.hay" 3 | 4 | struct AccessorExpr { 5 | pub Token: token 6 | pub Token: ident 7 | pub Vec: inner 8 | } -------------------------------------------------------------------------------- /selfhost/src/ast/expr/annotated_call.hay: -------------------------------------------------------------------------------- 1 | include "vec.hay" 2 | include "selfhost/src/ast/arg/untyped.hay" 3 | include "selfhost/src/lex/token.hay" 4 | 5 | struct AnnotatedCallExpr { 6 | pub Token: token 7 | pub Token: base 8 | pub Vec: annotations 9 | } -------------------------------------------------------------------------------- /selfhost/src/ast/expr/as.hay: -------------------------------------------------------------------------------- 1 | include "vec.hay" 2 | include "opt.hay" 3 | include "selfhost/src/ast/arg/ident.hay" 4 | include "selfhost/src/lex/token.hay" 5 | 6 | struct Expr: 7 | 8 | struct AsExpr { 9 | pub Token: token 10 | pub Vec: idents 11 | pub Opt>: block 12 | } 13 | 14 | -------------------------------------------------------------------------------- /selfhost/src/ast/expr/cast.hay: -------------------------------------------------------------------------------- 1 | include "selfhost/src/lex/token.hay" 2 | 3 | struct CastExpr { 4 | pub Token: token 5 | pub Token: type 6 | } -------------------------------------------------------------------------------- /selfhost/src/ast/expr/ident.hay: -------------------------------------------------------------------------------- 1 | include "selfhost/src/lex/token.hay" 2 | 3 | struct IdentExpr { 4 | pub Token: ident 5 | } -------------------------------------------------------------------------------- /selfhost/src/ast/expr/literal.hay: -------------------------------------------------------------------------------- 1 | include "selfhost/src/lex/literal.hay" 2 | include "selfhost/src/lex/token.hay" 3 | 4 | struct LiteralExpr { 5 | pub Literal: literal 6 | pub Token: token 7 | } -------------------------------------------------------------------------------- /selfhost/src/ast/expr/operator.hay: -------------------------------------------------------------------------------- 1 | include "selfhost/src/lex/operator.hay" 2 | include "selfhost/src/lex/token.hay" 3 | 4 | struct OperatorExpr { 5 | pub Operator: op 6 | pub Token: token 7 | } -------------------------------------------------------------------------------- /selfhost/src/ast/expr/return.hay: -------------------------------------------------------------------------------- 1 | include "selfhost/src/lex/token.hay" 2 | 3 | struct ReturnExpr { 4 | pub Token: token 5 | } -------------------------------------------------------------------------------- /selfhost/src/ast/expr/size_of.hay: -------------------------------------------------------------------------------- 1 | include "selfhost/src/lex/token.hay" 2 | 3 | struct SizeOfExpr { 4 | pub Token: token 5 | pub Token: type 6 | } -------------------------------------------------------------------------------- /selfhost/src/ast/expr/syscall.hay: -------------------------------------------------------------------------------- 1 | include "selfhost/src/lex/token.hay" 2 | 3 | struct SyscallExpr { 4 | pub u64: n 5 | pub Token: token 6 | } -------------------------------------------------------------------------------- /selfhost/src/ast/expr/unary.hay: -------------------------------------------------------------------------------- 1 | include "selfhost/src/ast/expr/operator.hay" 2 | 3 | struct Expr: 4 | 5 | struct UnaryExpr { 6 | pub OperatorExpr: op 7 | pub &Expr: expr 8 | } -------------------------------------------------------------------------------- /selfhost/src/ast/expr/var.hay: -------------------------------------------------------------------------------- 1 | include "selfhost/src/lex/token.hay" 2 | 3 | struct VarExpr { 4 | pub Token: token 5 | pub Token: type 6 | pub Token: ident 7 | } -------------------------------------------------------------------------------- /selfhost/src/ast/expr/while.hay: -------------------------------------------------------------------------------- 1 | include "vec.hay" 2 | include "selfhost/src/lex/token.hay" 3 | 4 | struct Expr: 5 | 6 | struct WhileExpr { 7 | pub Token: token 8 | pub Vec: cond 9 | pub Vec: body 10 | } -------------------------------------------------------------------------------- /selfhost/src/ast/member/untyped.hay: -------------------------------------------------------------------------------- 1 | include "selfhost/src/ast/visibility.hay" 2 | include "selfhost/src/lex/token.hay" 3 | 4 | struct UntypedMember { 5 | pub Token: parent 6 | pub Visibility: vis 7 | pub Token: token 8 | pub Token: ident 9 | } -------------------------------------------------------------------------------- /selfhost/src/ast/stmt/enum.hay: -------------------------------------------------------------------------------- 1 | include "vec.hay" 2 | include "selfhost/src/lex/token.hay" 3 | 4 | struct EnumStmt { 5 | pub Token: token 6 | pub Token: name 7 | pub Vec: variants 8 | } -------------------------------------------------------------------------------- /selfhost/src/ast/stmt/pre_declaration.hay: -------------------------------------------------------------------------------- 1 | include "opt.hay" 2 | include "vec.hay" 3 | include "selfhost/src/ast/arg/untyped.hay" 4 | include "selfhost/src/lex/token.hay" 5 | include "selfhost/src/types/record/record_kind.hay" 6 | 7 | struct PreDeclarationStmt { 8 | pub Token: token 9 | pub Token: name 10 | pub RecordKind: kind 11 | pub Opt>: annotations 12 | } 13 | -------------------------------------------------------------------------------- /selfhost/src/ast/stmt/var.hay: -------------------------------------------------------------------------------- 1 | include "selfhost/src/lex/token.hay" 2 | include "selfhost/src/ast/expr/var.hay" 3 | 4 | struct VarStmt { 5 | pub Token: token 6 | pub VarExpr: expr 7 | } -------------------------------------------------------------------------------- /selfhost/src/ast/visibility.hay: -------------------------------------------------------------------------------- 1 | enum Visibility { 2 | Public 3 | Private 4 | } -------------------------------------------------------------------------------- /selfhost/src/types/function/fn_tag.hay: -------------------------------------------------------------------------------- 1 | enum FnTag { 2 | Inline 3 | OnCopy 4 | OnDrop 5 | } -------------------------------------------------------------------------------- /src/ast/stmt/stmt_kind.rs: -------------------------------------------------------------------------------- 1 | use crate::types::TypeId; 2 | 3 | #[derive(Debug, Clone)] 4 | pub enum StmtKind { 5 | Var, 6 | Function, 7 | InterfaceFunction(TypeId), 8 | } 9 | -------------------------------------------------------------------------------- /src/ast/visibility.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] 2 | pub enum Visitiliby { 3 | Public, 4 | Private, 5 | } 6 | -------------------------------------------------------------------------------- /src/lex/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod base; 2 | pub mod scanner; 3 | pub mod token; 4 | -------------------------------------------------------------------------------- /src/tests/examples/advanced_features.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 examples/advanced_features.asm\n[CMD]: ld -o advanced_features examples/advanced_features.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/advanced_features.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "7\n\t6\n\t\t5\n\t\t4\n\t3\n\t\t2\n\t\t1\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/fizzbuzz.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 examples/fizzbuzz.asm\n[CMD]: ld -o fizzbuzz examples/fizzbuzz.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/function.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 examples/function.asm\n[CMD]: ld -o function examples/function.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/function.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "verbose: 3\nmiddle: 3\nterse: 3\nNumbers pushed: \n 3\n 2\n 1\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/generics.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 examples/generics.asm\n[CMD]: ld -o generics examples/generics.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/hello.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 examples/hello.asm\n[CMD]: ld -o hello examples/hello.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/hello.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Hello World!\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/interfaces.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 examples/interfaces.asm\n[CMD]: ld -o interfaces examples/interfaces.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/interfaces.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "3\n3\n3\nPoint(4, 6)\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/loops_and_branching.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 examples/loops_and_branching.asm\n[CMD]: ld -o loops_and_branching examples/loops_and_branching.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/loops_and_branching.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "1\n1\n2\n3\n5\n8\n13\n21\n34\n55\n89\n144\n233\n377\n610\n987\n1597\n2584\n4181\n6765\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/numbers_1.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 examples/numbers_1.asm\n[CMD]: ld -o numbers_1 examples/numbers_1.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/numbers_1.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "5\n4\n3\n2\n1\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/numbers_2.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 examples/numbers_2.asm\n[CMD]: ld -o numbers_2 examples/numbers_2.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/numbers_2.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "30\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/pointers.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 examples/pointers.asm\n[CMD]: ld -o pointers examples/pointers.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/pointers.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "H\ne\nl\nl\no\n \nW\no\nr\nl\nd\n12345\n54321\n54321\n54321\n54321\n54321\nFizzBuzz\nHello World\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/user_defined_types.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 examples/user_defined_types.asm\n[CMD]: ld -o user_defined_types examples/user_defined_types.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/user_defined_types.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "first: 1\nsecond: 2\nsecond: 2\nfirst: 1\nRed and green the same colour: false\nHello World\n11\n12345\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/variable.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 examples/variable.asm\n[CMD]: ld -o variable examples/variable.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/examples/variable.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "1\n2\n2\n1\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/address_of_framed.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/address_of_framed.asm\n[CMD]: ld -o address_of_framed src/tests/functional/address_of_framed.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/address_of_framed.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\nHello World\n12345\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/address_of_union.hay: -------------------------------------------------------------------------------- 1 | union Foo { 2 | u64: A 3 | bool: B 4 | } 5 | 6 | fn main() { 7 | 12345 cast(Foo) 8 | false cast(Foo) 9 | as [foo_u64 mut foo_bool] 10 | 11 | &foo_u64::A @ println 12 | &foo_bool::B @ println 13 | 54321 cast(Foo) *foo_bool ! 14 | &foo_bool::A @ println 15 | } -------------------------------------------------------------------------------- /src/tests/functional/address_of_union.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/address_of_union.asm\n[CMD]: ld -o address_of_union src/tests/functional/address_of_union.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/address_of_union.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "12345\nfalse\n54321\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/aliasing.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | 1 as [foo] 4 | { 5 | 2 as [foo] 6 | foo println 7 | } 8 | foo println 9 | 10 | "Hello World" as [s] 11 | s println 12 | s::size println 13 | "Goodbye" as [s] 14 | s println 15 | s::size println 16 | 17 | 18 | } -------------------------------------------------------------------------------- /src/tests/functional/aliasing.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/aliasing.asm\n[CMD]: ld -o aliasing src/tests/functional/aliasing.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/aliasing.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "2\n1\nHello World\n11\nGoodbye\n7\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/anonymous_structures.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/anonymous_structures.asm\n[CMD]: ld -o anonymous_structures src/tests/functional/anonymous_structures.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/anonymous_structures.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Foo::Value(12345)\nFoo::Tuple[12345 54321]\nFoo::Named { x: 12345 y: 54321 }\na\nb\na\nb\nb\na\n[a b]\n[9 4]\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/array.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/array.asm\n[CMD]: ld -o array src/tests/functional/array.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/array.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Hello World1\nHello World2\nHello World3\n97\n97\n97\n97\n97\n98\n98\n98\n98\n98\n99\n99\n99\n99\n99\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/array_of_tuples.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/array_of_tuples.asm\n[CMD]: ld -o array_of_tuples src/tests/functional/array_of_tuples.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/array_of_tuples.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[0 0]\n[1 2]\n[2 4]\n[3 6]\n[4 8]\n[5 10]\n[6 12]\n[7 14]\n[8 16]\n[9 18]\n[10 20]\n[11 22]\n[12 24]\n[13 26]\n[14 28]\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/associated_type_in_return.hay: -------------------------------------------------------------------------------- 1 | fn foo() -> [Add::Output] { 2 | 3 4 + 3 | } 4 | 5 | fn main() { 6 | foo println 7 | } -------------------------------------------------------------------------------- /src/tests/functional/associated_type_in_return.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/associated_type_in_return.asm\n[CMD]: ld -o associated_type_in_return src/tests/functional/associated_type_in_return.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/associated_type_in_return.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "7\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/blanket_impl.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/blanket_impl.asm\n[CMD]: ld -o blanket_impl src/tests/functional/blanket_impl.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/blanket_impl.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Hello world!\n12345\n54321\nHello Print!\n9\n8\n7\n6\n5\n4\n3\n2\n1\n0\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/blanket_impl_override.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/blanket_impl_override.asm\n[CMD]: ld -o blanket_impl_override src/tests/functional/blanket_impl_override.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/blanket_impl_override.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Hello world!\n12345\n54321\nInside override\nHello Print!\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/cat.hay: -------------------------------------------------------------------------------- 1 | fn cat(Str: path) { 2 | path File.read_to_string as [file_str] 3 | file_str println 4 | &file_str String.delete 5 | } 6 | 7 | fn main() { 8 | "./src/tests/functional/cat.hay" cat 9 | } -------------------------------------------------------------------------------- /src/tests/functional/cat.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/cat.asm\n[CMD]: ld -o cat src/tests/functional/cat.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/cat.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "fn cat(Str: path) {\n path File.read_to_string as [file_str]\n file_str println \n &file_str String.delete\n}\n\nfn main() {\n \"./src/tests/functional/cat.hay\" cat\n}\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/concrete_sum_type.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/concrete_sum_type.asm\n[CMD]: ld -o concrete_sum_type src/tests/functional/concrete_sum_type.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/concrete_sum_type.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Foo::Unit\nFoo::Value(Hello Sum Types)\nFoo::Tuple[1 two false]\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/early_return_basic.hay: -------------------------------------------------------------------------------- 1 | fn foo(u64) -> [u64] { 2 | return 3 | } 4 | 5 | fn main() { 6 | 7 | 10 foo println 8 | 9 | } -------------------------------------------------------------------------------- /src/tests/functional/early_return_basic.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/early_return_basic.asm\n[CMD]: ld -o early_return_basic src/tests/functional/early_return_basic.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/early_return_basic.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "10\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/early_return_if_else_while.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/early_return_if_else_while.asm\n[CMD]: ld -o early_return_if_else_while src/tests/functional/early_return_if_else_while.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/early_return_if_else_while.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "true\nfalse\ntrue\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/early_return_while_condition.hay: -------------------------------------------------------------------------------- 1 | fn foo() -> [u64] { 2 | 3 | while 42 return do { 4 | "unreachable" println 5 | } 6 | 7 | } 8 | 9 | fn main() { 10 | 11 | foo println 12 | 13 | } -------------------------------------------------------------------------------- /src/tests/functional/early_return_while_condition.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/early_return_while_condition.asm\n[CMD]: ld -o early_return_while_condition src/tests/functional/early_return_while_condition.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/early_return_while_condition.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "42\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/empty_string.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | "" as [s] 3 | s::size 0 == println 4 | "`" print s print "`" println 5 | } 6 | -------------------------------------------------------------------------------- /src/tests/functional/empty_string.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/empty_string.asm\n[CMD]: ld -o empty_string src/tests/functional/empty_string.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/empty_string.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "true\n``\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/enum.hay: -------------------------------------------------------------------------------- 1 | enum Foo { 2 | x 3 | y 4 | z 5 | } 6 | 7 | fn main() { 8 | Foo::x Foo::z == if { 9 | "Enums match!" println 10 | } else { 11 | "Enums don't match" println 12 | } 13 | } -------------------------------------------------------------------------------- /src/tests/functional/enum.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/enum.asm\n[CMD]: ld -o enum src/tests/functional/enum.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/enum.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Enums don't match\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/enum_struct_generic1.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/enum_struct_generic1.asm\n[CMD]: ld -o enum_struct_generic1 src/tests/functional/enum_struct_generic1.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/enum_struct_generic1.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "1\n_\nHello World\n_\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/enum_struct_generic2.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/enum_struct_generic2.asm\n[CMD]: ld -o enum_struct_generic2 src/tests/functional/enum_struct_generic2.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/enum_struct_generic2.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "None\nNone\nSome(1)\nSome(Hello World)\nOk(this is an ok str)\nErr(This is an err str)\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/enum_struct_generic_else.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/enum_struct_generic_else.asm\n[CMD]: ld -o enum_struct_generic_else src/tests/functional/enum_struct_generic_else.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/enum_struct_generic_else.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "None\nSome(1)\nNone\nSome(h)\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/enum_struct_match_else_only.hay: -------------------------------------------------------------------------------- 1 | enum struct Foo { 2 | u64: Bar 3 | Str: Baz 4 | } 5 | 6 | impl Print { 7 | fn print(Foo) match { 8 | else { "Printing a foo!" print } 9 | } 10 | } 11 | 12 | fn main() { 13 | 14 | 1 cast(Foo::Bar) println 15 | "Hello" cast(Foo::Baz) println 16 | } -------------------------------------------------------------------------------- /src/tests/functional/enum_struct_match_else_only.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/enum_struct_match_else_only.asm\n[CMD]: ld -o enum_struct_match_else_only src/tests/functional/enum_struct_match_else_only.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/enum_struct_match_else_only.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Printing a foo!\nPrinting a foo!\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/enum_struct_match_nested.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/enum_struct_match_nested.asm\n[CMD]: ld -o enum_struct_match_nested src/tests/functional/enum_struct_match_nested.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/enum_struct_match_nested.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Foo1 was number: 2\nFoo2 was number: 1\nFoo1 was string: Hello\nFoo2 was string: World\nFoo1 was string: Hello\nFoo2 was number: 1\nFoo1 was number: 2\nFoo2 was string: World\n12345\n0\nNot a str\nHello World\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/enum_variants.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/enum_variants.asm\n[CMD]: ld -o enum_variants src/tests/functional/enum_variants.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/enum_variants.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Bar\nBaz\nFound a bar!\nFound a baz!\nFound a bar!\nFound a baz!\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/enum_variants_branching.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/enum_variants_branching.asm\n[CMD]: ld -o enum_variants_branching src/tests/functional/enum_variants_branching.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/enum_variants_branching.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "A bunch of logic which always results in Foo::Bar\nFoo::Bar\nA bunch of logic which always results in Foo::Baz\nFoo::Baz\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/enum_variants_loop.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/enum_variants_loop.asm\n[CMD]: ld -o enum_variants_loop src/tests/functional/enum_variants_loop.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/enum_variants_loop.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Foo::Bar\nFoo::Baz\nFoo::Baz\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/generic_fn_with_const_ptr_arg.hay: -------------------------------------------------------------------------------- 1 | fn foo(T) { drop } 2 | 3 | fn main() { 4 | 5 | 12345 as [n] 6 | &n foo 7 | 8 | } -------------------------------------------------------------------------------- /src/tests/functional/generic_fn_with_const_ptr_arg.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/generic_fn_with_const_ptr_arg.asm\n[CMD]: ld -o generic_fn_with_const_ptr_arg src/tests/functional/generic_fn_with_const_ptr_arg.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/generic_fn_with_const_ptr_arg.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/generic_pair_add.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/generic_pair_add.asm\n[CMD]: ld -o generic_pair_add src/tests/functional/generic_pair_add.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/generic_pair_add.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Pair(Foo(1), Foo(2))\nPair(Bar(3), Buzz(4))\nPair(Baz(4), Qux(6))\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/generic_struct.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/generic_struct.asm\n[CMD]: ld -o generic_struct src/tests/functional/generic_struct.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/generic_struct.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Hello\nWorld\n2\n1\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/hello_world.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | "Hello World!" println 3 | } -------------------------------------------------------------------------------- /src/tests/functional/hello_world.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/hello_world.asm\n[CMD]: ld -o hello_world src/tests/functional/hello_world.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/hello_world.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Hello World!\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/hstring.hay: -------------------------------------------------------------------------------- 1 | include "std/string.hay" 2 | 3 | fn main() { 4 | 5 | "Hello World" as [s] 6 | s String.new as [hs] 7 | 8 | s::size println 9 | &hs String.size println 10 | s println 11 | &hs String.as_str println 12 | &hs String.delete 13 | Heap.debug_summary 14 | 15 | } -------------------------------------------------------------------------------- /src/tests/functional/hstring.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/hstring.asm\n[CMD]: ld -o hstring src/tests/functional/hstring.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/hstring.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "11\n11\nHello World\nHello World\nHeap:\n * [ | 4072 false | ] 4096\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/if_else.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | 1 2 as[a b] 4 | 5 | a b > if { 6 | 1 7 | } else a b == if { 8 | 2 9 | } else { 10 | 3 11 | } 12 | 13 | println 14 | 15 | } -------------------------------------------------------------------------------- /src/tests/functional/if_else.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/if_else.asm\n[CMD]: ld -o if_else src/tests/functional/if_else.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/if_else.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "3\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/impl.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | T: bar 3 | 4 | impl: 5 | fn Foo.new(T) -> [Foo] { cast(Foo) } 6 | fn get_bar(Foo: foo) -> [T] { foo::bar } 7 | } 8 | 9 | fn main() { 10 | 11 | "Private Field" Foo.new get_bar println 12 | 12345 Foo.new get_bar println 13 | 14 | } -------------------------------------------------------------------------------- /src/tests/functional/impl.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/impl.asm\n[CMD]: ld -o impl src/tests/functional/impl.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/impl.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Private Field\n12345\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/inline_fn.hay: -------------------------------------------------------------------------------- 1 | inline fn my_add(u64: a u64: b) -> [u64] { a b + } 2 | 3 | fn main() { 4 | 1 2 my_add println 5 | 4 5 my_add println 6 | } -------------------------------------------------------------------------------- /src/tests/functional/inline_fn.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/inline_fn.asm\n[CMD]: ld -o inline_fn src/tests/functional/inline_fn.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/inline_fn.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "3\n9\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/inline_impl_fn.hay: -------------------------------------------------------------------------------- 1 | 2 | struct Foo { 3 | u64: bar 4 | impl: 5 | inline fn Foo.add(u64: a u64: b) -> [u64] { a b + } 6 | } 7 | 8 | fn main() { 9 | 1 2 Foo.add println 10 | 4 5 Foo.add println 11 | } -------------------------------------------------------------------------------- /src/tests/functional/inline_impl_fn.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/inline_impl_fn.asm\n[CMD]: ld -o inline_impl_fn src/tests/functional/inline_impl_fn.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/inline_impl_fn.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "3\n9\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/inner_address_of_framed.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | "Hello World" as [str] 3 | &str::size @ str::size == println 4 | &str::data @ str::data == println 5 | } 6 | -------------------------------------------------------------------------------- /src/tests/functional/inner_address_of_framed.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/inner_address_of_framed.asm\n[CMD]: ld -o inner_address_of_framed src/tests/functional/inner_address_of_framed.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/inner_address_of_framed.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "true\ntrue\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/interface.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/interface.asm\n[CMD]: ld -o interface src/tests/functional/interface.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/interface.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "3\n3\n3\n3\nPoint(5, 3)\n54321\n12345\n111\n222\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/linear_map.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/linear_map.asm\n[CMD]: ld -o linear_map src/tests/functional/linear_map.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/linear_map.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Replaced value at key `one`: 0\n1\n2\n3\nDidn't find key `four`\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/local.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/local.asm\n[CMD]: ld -o local src/tests/functional/local.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/local.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Hello Local!\nHello Local!\nHello Local!\nFoo123456789012345678890!\nFoo123456789012345678890!\nFoo123456789012345678890!\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/match_on_variant.hay: -------------------------------------------------------------------------------- 1 | enum struct Foo { 2 | u64: Bar 3 | Str: Baz 4 | } 5 | 6 | fn take_foo_bar(Foo::Bar) match { 7 | Foo::Bar as [u] { u println } 8 | else { "unreachable" println } 9 | } 10 | 11 | fn main() { 12 | 13 | 12345 cast(Foo::Bar) take_foo_bar 14 | 15 | } -------------------------------------------------------------------------------- /src/tests/functional/match_on_variant.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/match_on_variant.asm\n[CMD]: ld -o match_on_variant src/tests/functional/match_on_variant.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/match_on_variant.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "12345\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/math.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/math.asm\n[CMD]: ld -o math src/tests/functional/math.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/math.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "2\n2\n2\n2\n1\n1\n1\n1\n6\n6\n6\n6\n5\n5\n5\n5\n12\n61\n49\n240\n15\ntrue\nfalse\nfalse\ntrue\nfalse\ntrue\ntrue\ntrue\nfalse\nfalse\ntrue\ntrue\ntrue\nfalse\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/multiple_mutable_bindings.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | 1 2 3 4 5 as [mut one mut two mut three mut four mut five] 4 | 11 *one ! 5 | 22 *two ! 6 | 33 *three ! 7 | 44 *four ! 8 | 55 *five ! 9 | 10 | one println 11 | two println 12 | three println 13 | four println 14 | five println 15 | 16 | } -------------------------------------------------------------------------------- /src/tests/functional/multiple_mutable_bindings.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/multiple_mutable_bindings.asm\n[CMD]: ld -o multiple_mutable_bindings src/tests/functional/multiple_mutable_bindings.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/multiple_mutable_bindings.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "11\n22\n33\n44\n55\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/mutable_fn_input.hay: -------------------------------------------------------------------------------- 1 | fn foo(u64: mut n) { 2 | n println 3 | 12345 *n ! 4 | n println 5 | } 6 | 7 | fn main() { 8 | 9 | 0 foo 10 | 11 | } -------------------------------------------------------------------------------- /src/tests/functional/mutable_fn_input.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/mutable_fn_input.asm\n[CMD]: ld -o mutable_fn_input src/tests/functional/mutable_fn_input.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/mutable_fn_input.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "0\n12345\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/nested_ident.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | 10 as [x] { 4 | 5 | x as [y] 6 | y println 7 | x as [z] { 8 | z println 9 | } 10 | x println 11 | } 12 | 13 | 20 as [x] { 14 | x as [y] 15 | y println 16 | x as [z] { 17 | z println 18 | } 19 | x println 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /src/tests/functional/nested_ident.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/nested_ident.asm\n[CMD]: ld -o nested_ident src/tests/functional/nested_ident.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/nested_ident.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "10\n10\n10\n20\n20\n20\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/number_literal_bases.hay: -------------------------------------------------------------------------------- 1 | 2 | fn main() { 3 | 12345 println 4 | 0xFF println 5 | 0o1234 println 6 | 0b1111 println 7 | 8 | 123 println 9 | 0xFFu8 println 10 | 0o123u8 println 11 | 0b1111u8 println 12 | } -------------------------------------------------------------------------------- /src/tests/functional/number_literal_bases.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/number_literal_bases.asm\n[CMD]: ld -o number_literal_bases src/tests/functional/number_literal_bases.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/number_literal_bases.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "12345\n255\n668\n15\n123\n255\n83\n15\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/option.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | "Hello World" Option.Some as [someStr] 4 | 5 | &someStr Option.is_some println 6 | &someStr Option.is_none println 7 | someStr Option.unwrap println 8 | 9 | Option.None:: as [noneStr] 10 | &noneStr Option.is_some println 11 | &noneStr Option.is_some println 12 | 13 | noneStr Option.unwrap println 14 | 15 | } -------------------------------------------------------------------------------- /src/tests/functional/option.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/option.asm\n[CMD]: ld -o option src/tests/functional/option.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/option.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "true\nfalse\nHello World\nfalse\nfalse\nUnwrapped a None variant\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/pointer.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | var char[64]: chars 4 | 5 | "Hello World!" as [word] 6 | 0 while dup word::size < do { 7 | as [i] 8 | word::data i ptr+ @ 9 | chars::data @ i ptr+_mut ! 10 | i 1 + 11 | } drop 12 | 13 | word::size chars::data @ cast(Str) println 14 | 15 | } -------------------------------------------------------------------------------- /src/tests/functional/pointer.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/pointer.asm\n[CMD]: ld -o pointer src/tests/functional/pointer.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/pointer.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Hello World!\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/pointer_offsets.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/pointer_offsets.asm\n[CMD]: ld -o pointer_offsets src/tests/functional/pointer_offsets.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/pointer_offsets.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Hello World!\nbar::bool: false\nbar::foo::u8: 123\nbar::foo::char: q\nbar::foo::bool: true\nbar::number: 54321\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/pointer_types.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/pointer_types.asm\n[CMD]: ld -o pointer_types src/tests/functional/pointer_types.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/pointer_types.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "12345\n54321\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/pre_declare.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/functional/pre_declare.hay:1:1] Error: No entry point was found\n" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/print_to_string_fmt.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/print_to_string_fmt.asm\n[CMD]: ld -o print_to_string_fmt src/tests/functional/print_to_string_fmt.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/print_to_string_fmt.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "true\ntrue\nfalse\nfalse\ntrue\ntrue\nfalse\nfalse\nh\nh\nh\nh\n12345\n12345\n12345\n12345\n123\n123\n123\n123\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/result.hay: -------------------------------------------------------------------------------- 1 | include "std/assert.hay" 2 | fn main() { 3 | 4 | 12345 Result.Ok:: { 5 | as [r] 6 | &r Result.is_ok assert 7 | r Result.unwrap println 8 | } 9 | 10 | "Error Result!" Result.Err:: { 11 | as [r] 12 | &r Result.is_err assert 13 | r Result.unwrap_err println 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /src/tests/functional/result.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/result.asm\n[CMD]: ld -o result src/tests/functional/result.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/result.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "12345\nError Result!\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/struct.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/struct.asm\n[CMD]: ld -o struct src/tests/functional/struct.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/struct.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "2\n1\n4\n3\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/struct_accessors.hay: -------------------------------------------------------------------------------- 1 | 2 | 3 | struct Words { 4 | pub Str: hello 5 | pub Str: world 6 | } 7 | 8 | fn main() { 9 | "Hello\n" "World!\n" cast(Words) 10 | as [words] 11 | 12 | words::hello print 13 | words::world print 14 | words::hello::size println 15 | words::world::size println 16 | 17 | } -------------------------------------------------------------------------------- /src/tests/functional/struct_accessors.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/struct_accessors.asm\n[CMD]: ld -o struct_accessors src/tests/functional/struct_accessors.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/struct_accessors.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Hello\nWorld!\n6\n7\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/tuple_accessors_unary.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/tuple_accessors_unary.asm\n[CMD]: ld -o tuple_accessors_unary src/tests/functional/tuple_accessors_unary.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/tuple_accessors_unary.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[9 16]\n[16 25]\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/tuple_destructure.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/tuple_destructure.asm\n[CMD]: ld -o tuple_destructure src/tests/functional/tuple_destructure.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/tuple_destructure.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Foo::Bar[12345 54321]\nFoo::Baz[Hello World]\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/tuple_expressions.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/tuple_expressions.asm\n[CMD]: ld -o tuple_expressions src/tests/functional/tuple_expressions.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/tuple_expressions.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[7 false 4]\n[4 true 7]\n[2 4]\n[12345 false]\n[1 [2 false]]\n0\n[]\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/tuple_expressions2.hay: -------------------------------------------------------------------------------- 1 | 2 | fn foo(u64: n) -> [u64 u64 u64] { 3 | n 4 | n 2 * 5 | n 3 * 6 | } 7 | 8 | fn bar(u64: n) -> [[u64 u64 u64]] { 9 | [n foo] 10 | } 11 | 12 | fn main() { 13 | [1 true] println 14 | ["Hello" "Tuples"] println 15 | 16 | 3 foo cast([u64 u64 u64]) println 17 | 5 bar println 18 | } -------------------------------------------------------------------------------- /src/tests/functional/tuple_expressions2.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/tuple_expressions2.asm\n[CMD]: ld -o tuple_expressions2 src/tests/functional/tuple_expressions2.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/tuple_expressions2.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[1 true]\n[Hello Tuples]\n[3 6 9]\n[5 10 15]\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/tuple_printing.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/tuple_printing.asm\n[CMD]: ld -o tuple_printing src/tests/functional/tuple_printing.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/tuple_printing.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "c\n[x Str]\n[one]\n[one true]\n[one true 3]\n[one true 3 4]\n[one true 3 [4 five]]\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/union.hay: -------------------------------------------------------------------------------- 1 | union Foo { 2 | u64: x 3 | Str: s 4 | } 5 | 6 | fn main() { 7 | 69 cast(Foo) as [foo_u64] 8 | "Hello World" cast(Foo) as [foo_str] 9 | "Foo as u64: " print foo_u64::x println 10 | "Bad::data: " print foo_u64::s::data cast(u64) println 11 | "Bad::size: " print foo_u64::s::size println 12 | "Foo as str: " print foo_str::s println 13 | 14 | } -------------------------------------------------------------------------------- /src/tests/functional/union.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/union.asm\n[CMD]: ld -o union src/tests/functional/union.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/union.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Foo as u64: 69\nBad::data: 0\nBad::size: 69\nFoo as str: Hello World\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/unpack_tuple.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | [1 true "Three"] unpack 3 | println 4 | println 5 | println 6 | } -------------------------------------------------------------------------------- /src/tests/functional/unpack_tuple.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/unpack_tuple.asm\n[CMD]: ld -o unpack_tuple src/tests/functional/unpack_tuple.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/unpack_tuple.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Three\ntrue\n1\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/valid_pointer_operations.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | 12345 as [mut number] 4 | &number @ println 5 | *number @ println 6 | 54321 *number ! 7 | &number @ println 8 | } -------------------------------------------------------------------------------- /src/tests/functional/valid_pointer_operations.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/valid_pointer_operations.asm\n[CMD]: ld -o valid_pointer_operations src/tests/functional/valid_pointer_operations.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/valid_pointer_operations.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "12345\n12345\n54321\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/vec.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/vec.asm\n[CMD]: ld -o vec src/tests/functional/vec.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/vec_formatting.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | Vec.new:: as [mut v] 4 | 0 while dup 10 < do { 5 | as [i] 6 | "" String.new &v fmt println 7 | i *v Vec.push 8 | i 1 + 9 | } drop 10 | 11 | "" String.new v fmt println 12 | 13 | } -------------------------------------------------------------------------------- /src/tests/functional/vec_formatting.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/vec_formatting.asm\n[CMD]: ld -o vec_formatting src/tests/functional/vec_formatting.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/vec_formatting.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[ ]\n[0]\n[0 1]\n[0 1 2]\n[0 1 2 3]\n[0 1 2 3 4]\n[0 1 2 3 4 5]\n[0 1 2 3 4 5 6]\n[0 1 2 3 4 5 6 7]\n[0 1 2 3 4 5 6 7 8]\n[0 1 2 3 4 5 6 7 8 9]\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/zero_sized_type_pointer_ops.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | var []: zst_p 3 | [] zst_p ! 4 | zst_p @ println 5 | } 6 | -------------------------------------------------------------------------------- /src/tests/functional/zero_sized_type_pointer_ops.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/functional/zero_sized_type_pointer_ops.asm\n[CMD]: ld -o zero_sized_type_pointer_ops src/tests/functional/zero_sized_type_pointer_ops.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/functional/zero_sized_type_pointer_ops.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[]\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/anon_struct_bad_close.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 1 cast({u64: x) 3 | } -------------------------------------------------------------------------------- /src/tests/parser/anon_struct_bad_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/anon_struct_bad_close.hay:2:19] Error: Expected a `}` to close the tuple, but found ) instead\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_as_block_bad_close.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | 1 as [foo } 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_as_block_bad_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_as_block_bad_close.hay:3:15] Error: Expected `]` after `as`, but found `}` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_as_block_bad_destructure_close.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 1 2 as [[a b c )] 3 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_as_block_bad_destructure_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_as_block_bad_destructure_close.hay:2:20] Error: Expected `]` after identifiers, but found ) instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_as_block_bad_open.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | 1 as (foo) 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_as_block_bad_open.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_as_block_bad_open.hay:3:10] Error: Expected `[` after `as`, but found `(` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_as_block_empty_destructure.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | as [[]] 3 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_as_block_empty_destructure.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_as_block_empty_destructure.hay:2:9] Error: Tuple destructuring assignment must have at least one identifier.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_accessor1.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | foo::[ 3 | 4 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_accessor1.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_accessor1.hay:2:10] Error: Expected either an identifier or `<` after `::`, but found `[` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_accessor2.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | foo::bar::[ 3 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_accessor2.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_accessor2.hay:2:15] Error: Expected an identifier after `::`, but found `[` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_accessor3.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | foo::bar:: 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_accessor3.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_accessor3.hay:3:15] Error: Cannot provide annotations within this context.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_annotated_call_close.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | foo::` after call annotations, but found `u64` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_annotated_type.hay: -------------------------------------------------------------------------------- 1 | fn foo(bar` after type parameters, but found `u64` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_arg_identifier.hay: -------------------------------------------------------------------------------- 1 | fn foo(bar: 12345) { 2 | 3 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_arg_identifier.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_arg_identifier.hay:1:13] Error: Expected an identifier after `:`, but found `u64` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_array_var_close.hay: -------------------------------------------------------------------------------- 1 | 2 | var foo[1234 1234 -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_array_var_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_array_var_close.hay:2:14] Error: Expected `]` after array size, but found `u64`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_array_var_size.hay: -------------------------------------------------------------------------------- 1 | 2 | var foo["This isn't right"] -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_array_var_size.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_array_var_size.hay:2:9] Error: Expected array size after `[`, but found `Str`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_block_close.hay: -------------------------------------------------------------------------------- 1 | fn foo() -> [u64] { 12345 -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_block_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_block_close.hay:1:26] Error: Expected `}` at end of block, but found end of file instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_block_open.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | if true { 3 | 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_block_open.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_block_open.hay:2:8] Error: Expected `{` to open a block, but found `bool` instead\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_body_after_function_name.hay: -------------------------------------------------------------------------------- 1 | fn foo 1234 -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_body_after_function_name.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_body_after_function_name.hay:1:8] Error: Expected `(` after function name, but found `u64` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_cast_expr_close.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | cast(foo] 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_cast_expr_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_cast_expr_close.hay:3:13] Error: Expected `)` after `cast`, but found `]`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_cast_expr_open.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | cast 3 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_cast_expr_open.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_cast_expr_open.hay:3:1] Error: Expected `(` after `cast`, but found `}`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_cast_expr_param.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | cast(1234) 3 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_cast_expr_param.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_cast_expr_param.hay:2:9] Error: Expected type after `cast`, but found `u64` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_const_ptr_type.hay: -------------------------------------------------------------------------------- 1 | fn foo(&1) -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_const_ptr_type.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_const_ptr_type.hay:1:8] Error: Expected type after `&`, but found `u64` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_else_if_block.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | if { 4 | 5 | } else 1 2 3 4 -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_else_if_block.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_else_if_block.hay:5:19] Error: Expected `if`, but found end of file instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_expression.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | ] 3 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_expression.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_expression.hay:2:5] Error: Not sure how to parse expression from `]` yet\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_file_to_include.hay: -------------------------------------------------------------------------------- 1 | include "this_file_doesn't_exist.hay" -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_file_to_include.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_file_to_include.hay:1:1] Error: Failed to find file to include: this_file_doesn't_exist.hay.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_follow_up_to_inline.hay: -------------------------------------------------------------------------------- 1 | inline foo -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_follow_up_to_inline.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_follow_up_to_inline.hay:1:1] Error: Expected keyword `fn` after `include`, but found an identifier (foo)\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_function_annotation_close.hay: -------------------------------------------------------------------------------- 1 | fn foo` after function annotations, but found `u64` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_function_parameter_close.hay: -------------------------------------------------------------------------------- 1 | fn foo(u64 bool 1234 -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_function_parameter_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_function_parameter_close.hay:1:17] Error: Expected `)` after inputs, but found `u64` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_function_return_list_close.hay: -------------------------------------------------------------------------------- 1 | fn foo() -> [u64 bool 1234 -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_function_return_list_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_function_return_list_close.hay:1:23] Error: Expected `]` after return types, but found `u64` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_function_return_list_open.hay: -------------------------------------------------------------------------------- 1 | fn foo() -> u64 -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_function_return_list_open.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_function_return_list_open.hay:1:13] Error: Expected `[` after `->`, but found an identifier (u64) instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_generic_impl_close.hay: -------------------------------------------------------------------------------- 1 | impl` after impl annotations, but found end of file instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_generic_impl_requires.hay: -------------------------------------------------------------------------------- 1 | impl Foo 2 | requires: [Bar] 3 | { 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_generic_impl_requires.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_generic_impl_requires.hay:2:12] Error: Cannot have a requires block on a non-generic interface implementation.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_include_statement.hay: -------------------------------------------------------------------------------- 1 | include -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_include_statement.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_include_statement.hay:1:1] Error: Expected Str after include statement. Found end of file instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_inner_address_of.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | &foo:: 4 | 5 | 6 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_inner_address_of.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_inner_address_of.hay:6:1] Error: Expected either an identifier or `<` after `::`, but found `}` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_annotation_close.hay: -------------------------------------------------------------------------------- 1 | interface Foo` after function annotations, but found end of file instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_annotation_open.hay: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | 3 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_annotation_open.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_interface_annotation_open.hay:1:15] Error: Expected `<` after interface name, but found `{`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_associated_type.hay: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | _ Output 3 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_associated_type.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_interface_associated_type.hay:2:7] Error: Expected `:` after associated type placeholder, but found an identifier (Output) instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_associated_type_name.hay: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | _: 1 3 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_associated_type_name.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_interface_associated_type_name.hay:2:8] Error: Expected an identifier after `:`, but found `u64` instead\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_associated_type_placeholder.hay: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | u64: Output 3 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_associated_type_placeholder.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_interface_associated_type_placeholder.hay:2:5] Error: Expected `_` as placeholder for interface associated type, but found u64 instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_body_close.hay: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | fn foo(T) -> [T] 3 | ] -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_body_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_interface_body_close.hay:3:1] Error: Expected `}` after interface definition, but found `]` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_body_open.hay: -------------------------------------------------------------------------------- 1 | interface Foo [] -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_body_open.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_interface_body_open.hay:1:18] Error: Expected `{` after interface name, but found `[` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_impl_close.hay: -------------------------------------------------------------------------------- 1 | impl Foo { 2 | 3 | ] -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_impl_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_interface_impl_close.hay:3:1] Error: Expected `}` after interface implementation, but found `]` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_impl_open.hay: -------------------------------------------------------------------------------- 1 | impl Foo 0 -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_impl_open.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_interface_impl_open.hay:1:13] Error: Expected `{` after interface type, but found `u64` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_impl_type.hay: -------------------------------------------------------------------------------- 1 | impl "Hello World" -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_impl_type.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_interface_impl_type.hay:1:1] Error: Expected interface type after keyword `impl`, but found `Str` instead\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_name.hay: -------------------------------------------------------------------------------- 1 | interface {} -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_interface_name.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_interface_name.hay:1:11] Error: Expected interface name after `interface`, but found `{`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_on_copy_name.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | u64: bar 3 | impl: 4 | fn +Bar() {} 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_on_copy_name.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_on_copy_name.hay:4:8] Error: Unexpected On Copy function name.\n [Note]: Expected On Copy function to be named `+Foo`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_on_drop_name.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | u64: bar 3 | impl: 4 | fn -Bar() {} 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_on_drop_name.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_on_drop_name.hay:4:8] Error: Unexpected On Drop function name.\n [Note]: Expected On Drop function to be named `-Foo`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_pointer_type.hay: -------------------------------------------------------------------------------- 1 | fn foo(*) -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_pointer_type.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_pointer_type.hay:1:8] Error: Expected type after `*`, but found `)` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_requirement_close.hay: -------------------------------------------------------------------------------- 1 | struct Foo 2 | requires: [} { 3 | 4 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_requirement_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_requirement_close.hay:2:12] Error: Expected `]` after interface requirements. Found `}` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_requirement_list.hay: -------------------------------------------------------------------------------- 1 | struct Foo 2 | requires: [] { 3 | 4 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_requirement_list.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_requirement_list.hay:2:1] Error: Interface requirement list should not be empty.\n [Note]: Consider removing the `requires` list.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_requirement_open.hay: -------------------------------------------------------------------------------- 1 | struct Foo 2 | requires: {} { 3 | 4 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_requirement_open.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_requirement_open.hay:2:11] Error: Expected `[` after `:`. Found `{` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_requirement_start.hay: -------------------------------------------------------------------------------- 1 | struct Foo 2 | requires [] { 3 | 4 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_requirement_start.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_requirement_start.hay:2:10] Error: Expected `:` after keyword `requires`. Found `[` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_sizeof_close.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | sizeOf(foo} 3 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_sizeof_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_sizeof_close.hay:2:15] Error: Expected `)` after type identifier, but found `}` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_sizeof_open.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | sizeOf[foo] 4 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_sizeof_open.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_sizeof_open.hay:3:11] Error: Expected `(` after `sizeOf`, but found `[` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_sizeof_operand.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | sizeOf(1) drop 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_sizeof_operand.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_sizeof_operand.hay:3:11] Error: Expected a type identifier, but found `u64` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_sizeof_param.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | sizeOf(1234) 3 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_sizeof_param.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_sizeof_param.hay:2:11] Error: Expected a type identifier, but found `u64` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_top_level_token.hay: -------------------------------------------------------------------------------- 1 | "Hello World" -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_top_level_token.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_top_level_token.hay:1:1] Error: Unexpected top level token: `Str`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_tuple_expression_close.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | [ 4 | 1 2 3 4 5 -------------------------------------------------------------------------------- /src/tests/parser/parse_bad_tuple_expression_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_bad_tuple_expression_close.hay:4:18] Error: Expected `]`, but found end of file instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_enum_bad_close.hay: -------------------------------------------------------------------------------- 1 | enum foo { 2 | 3 | ] -------------------------------------------------------------------------------- /src/tests/parser/parse_enum_bad_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_enum_bad_close.hay:3:1] Error: Expected `}` after variants, but found `]` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_enum_bad_open.hay: -------------------------------------------------------------------------------- 1 | enum foo [ 2 | 3 | ] -------------------------------------------------------------------------------- /src/tests/parser/parse_enum_bad_open.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_enum_bad_open.hay:1:10] Error: Expected `{` after enum name, but found `[` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_enum_empty_variants.hay: -------------------------------------------------------------------------------- 1 | enum foo {} -------------------------------------------------------------------------------- /src/tests/parser/parse_enum_empty_variants.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_enum_empty_variants.hay:1:6] Error: Enumerations must have at least one variant.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_enum_without_identifier.hay: -------------------------------------------------------------------------------- 1 | enum 1234 -------------------------------------------------------------------------------- /src/tests/parser/parse_enum_without_identifier.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_enum_without_identifier.hay:1:6] Error: Expected an identifier after `enum`, but found `u64`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_function_empty_return_list.hay: -------------------------------------------------------------------------------- 1 | fn foo() -> [] {} -------------------------------------------------------------------------------- /src/tests/parser/parse_function_empty_return_list.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_function_empty_return_list.hay:1:13] Error: Expected a non-empty return list.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_function_without_name.hay: -------------------------------------------------------------------------------- 1 | fn 12345 -------------------------------------------------------------------------------- /src/tests/parser/parse_function_without_name.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_function_without_name.hay:1:4] Error: Expected function name after `fn`, but found `u64`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_match_as_too_many_args.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | match { 3 | Foo::Bar as [a b] 4 | } 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_match_as_too_many_args.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_match_as_too_many_args.hay:3:18] Error: `match` case statement as block expects only one ident.\n [Note]: Found: [\"a\", \"b\"]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_match_bad_as_close.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | match { 4 | Foo::Bar as [ x } 5 | } 6 | 7 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_match_bad_as_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_match_bad_as_close.hay:4:25] Error: Expected `]` after `match` case assignments, but found `}` instead\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_match_bad_as_open.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | match { 4 | Foo::Bar as { 5 | 6 | 7 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_match_bad_as_open.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_match_bad_as_open.hay:4:21] Error: Expected `[` after `as`, but found `{` instead\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_match_bad_close.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | match { 4 | 5 | ] 6 | 7 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_match_bad_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_match_bad_close.hay:5:5] Error: Expected `}` after `match` cases, but found `]` instead\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_match_bad_open.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | match [ 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_match_bad_open.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_match_bad_open.hay:3:11] Error: Expected `{` after `match`, but found `[` instead\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_missing_mutable_ident_in_as.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | 1 as [mut] 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_missing_mutable_ident_in_as.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_missing_mutable_ident_in_as.hay:3:11] Error: Expected an identifier after keyword `mut`, but found `]` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_mixed_identifier_arg_list.hay: -------------------------------------------------------------------------------- 1 | fn foo(u64: thing1 u64) {} -------------------------------------------------------------------------------- /src/tests/parser/parse_mixed_identifier_arg_list.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_mixed_identifier_arg_list.hay:1:7] Error: Either all arguments or no arguments in args list must have an identifier.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_mut_in_fn_output.hay: -------------------------------------------------------------------------------- 1 | fn foo() -> [mut u64] { 2 | 12345 3 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_mut_in_fn_output.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_mut_in_fn_output.hay:1:14] Error: Expected `]` after return types, but found `mut` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_named_args_in_return_list.hay: -------------------------------------------------------------------------------- 1 | fn foo() -> [u64: thing] -------------------------------------------------------------------------------- /src/tests/parser/parse_no_args_in_annotated_call.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | foo::<> 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_no_args_in_annotated_call.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_no_args_in_annotated_call.hay:3:10] Error: Expected a non-zero number of annotations\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_on_copy_outside_impl.hay: -------------------------------------------------------------------------------- 1 | fn +Foo() {} -------------------------------------------------------------------------------- /src/tests/parser/parse_on_copy_outside_impl.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_on_copy_outside_impl.hay:1:4] Error: On Copy functions cannot be defined outside of an impl block.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_on_drop_outside_impl.hay: -------------------------------------------------------------------------------- 1 | fn -Foo() {} -------------------------------------------------------------------------------- /src/tests/parser/parse_on_drop_outside_impl.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_on_drop_outside_impl.hay:1:4] Error: On Drop functions cannot be defined outside of an impl block.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_partially_named_args.hay: -------------------------------------------------------------------------------- 1 | fn foo(u64: bar bool) { } -------------------------------------------------------------------------------- /src/tests/parser/parse_partially_named_args.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_partially_named_args.hay:1:7] Error: Either all arguments or no arguments in args list must have an identifier.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_pub_in_union.hay: -------------------------------------------------------------------------------- 1 | union Foo { 2 | pub u64: bar 3 | } 4 | -------------------------------------------------------------------------------- /src/tests/parser/parse_pub_in_union.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_pub_in_union.hay:2:5] Error: Unexpected Keyword `pub` in union definition.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_recursive_type.hay: -------------------------------------------------------------------------------- 1 | struct Foo: 2 | struct Foo { 3 | Foo: bar 4 | } 5 | 6 | -------------------------------------------------------------------------------- /src/tests/parser/parse_recursive_type.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_recursive_type.hay:2:8] Error: Type Foo is recursive.\n [Note]: Consider adding some kind of indirection, such as a reference.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_struct_bad_annotations_close.hay: -------------------------------------------------------------------------------- 1 | struct foo` after `struct` generics, but found end of file instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_struct_bad_close.hay: -------------------------------------------------------------------------------- 1 | struct foo { 2 | bar: baz 3 | ] -------------------------------------------------------------------------------- /src/tests/parser/parse_struct_bad_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_struct_bad_close.hay:3:1] Error: Expected `}` to close structure, but found `]` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_struct_bad_impl_open.hay: -------------------------------------------------------------------------------- 1 | struct foo { 2 | bar: baz 3 | impl 4 | 5 | fn work() {} 6 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_struct_bad_impl_open.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_struct_bad_impl_open.hay:5:5] Error: Expected `:` after `impl`, but found `fn`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_struct_bad_open.hay: -------------------------------------------------------------------------------- 1 | struct foo [] -------------------------------------------------------------------------------- /src/tests/parser/parse_struct_bad_open.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_struct_bad_open.hay:1:12] Error: Expected `{` after struct name, but found `[` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_struct_empty_members.hay: -------------------------------------------------------------------------------- 1 | struct foo {} -------------------------------------------------------------------------------- /src/tests/parser/parse_struct_empty_members.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_struct_empty_members.hay:1:8] Error: struct members cannot be empty.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_struct_member_without_identifier1.hay: -------------------------------------------------------------------------------- 1 | struct foo { 2 | pub u64 3 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_struct_member_without_identifier1.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_struct_member_without_identifier1.hay:3:1] Error: Expected `:` after type, but found `}` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_struct_member_without_identifier2.hay: -------------------------------------------------------------------------------- 1 | struct foo { 2 | pub u64 : 1234 3 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_struct_member_without_identifier2.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_struct_member_without_identifier2.hay:2:15] Error: Expected an identifier, but found `u64` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_struct_pub_member_without_type.hay: -------------------------------------------------------------------------------- 1 | struct foo { 2 | pub : bar 3 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_struct_pub_member_without_type.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_struct_pub_member_without_type.hay:2:5] Error: Expected a type after `pub`, but found `:` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_struct_without_identifier.hay: -------------------------------------------------------------------------------- 1 | struct 1234 -------------------------------------------------------------------------------- /src/tests/parser/parse_struct_without_identifier.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_struct_without_identifier.hay:1:8] Error: Expected an identifier after `struct`, but found `u64` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_tuple_bad_close.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | 1 2 cast([u64 u64) 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_tuple_bad_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_tuple_bad_close.hay:3:22] Error: Expected a `]` to close the tuple, but found ) instead\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_tuple_empty.hay: -------------------------------------------------------------------------------- 1 | var [][123]: Foo 2 | 3 | fn main() { 4 | "Hello World!" cast([]) cast([Str []]) 12345 cast([[Str []] u64]) as [x] 5 | x::0::0 println 6 | x::0::1 println 7 | x::1 println 8 | 9 | sizeOf([]) println 10 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_tuple_empty.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/parser/parse_tuple_empty.asm\n[CMD]: ld -o parse_tuple_empty src/tests/parser/parse_tuple_empty.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_tuple_empty.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Hello World!\n[]\n12345\n0\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_type_missing_associated_type_identifier.hay: -------------------------------------------------------------------------------- 1 | var Foo:: -------------------------------------------------------------------------------- /src/tests/parser/parse_type_missing_associated_type_identifier.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_type_missing_associated_type_identifier.hay:1:17] Error: Expected an identifier after `::`, but found end of file instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_var_expr_bad_ident.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | var foo: 1234 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_var_expr_bad_ident.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_var_expr_bad_ident.hay:3:14] Error: Expected an identifier after an identifier (), but found `u64` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_var_expr_bad_type.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | var 1234 3 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_var_expr_bad_type.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_var_expr_bad_type.hay:2:5] Error: Expected a type after `var`, but found `u64` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_var_expr_missing_colon.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | var foo bar 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_var_expr_missing_colon.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_var_expr_missing_colon.hay:3:13] Error: Expected `:` after type, but found an identifier (bar)\n" 5 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_while_without_do.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | 0 while dup 10 < { 4 | as [i] 5 | i println 6 | i 1 + 7 | } drop 8 | 9 | } -------------------------------------------------------------------------------- /src/tests/parser/parse_while_without_do.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/parser/parse_while_without_do.hay:3:7] Error: Expected `do` after `while` to mark loop body.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/scanner/scan_bad_equals_operator.hay: -------------------------------------------------------------------------------- 1 | =@ -------------------------------------------------------------------------------- /src/tests/scanner/scan_bad_equals_operator.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/scanner/scan_bad_equals_operator.hay:1:1] Error: Unrecognized token: `=@`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/scanner/scan_bad_escaped_char.hay: -------------------------------------------------------------------------------- 1 | '\c' -------------------------------------------------------------------------------- /src/tests/scanner/scan_bad_escaped_char.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/scanner/scan_bad_escaped_char.hay:1:1] Error: Unknown escaped character: `\\c`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/scanner/scan_bad_number_literal.hay: -------------------------------------------------------------------------------- 1 | 18446744073709551616 -------------------------------------------------------------------------------- /src/tests/scanner/scan_bad_number_literal.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/scanner/scan_bad_number_literal.hay:1:1] Error: Failed to parse number from 18446744073709551616\n" 5 | } -------------------------------------------------------------------------------- /src/tests/scanner/scan_bad_syscall_close.hay: -------------------------------------------------------------------------------- 1 | syscall(1 -------------------------------------------------------------------------------- /src/tests/scanner/scan_bad_syscall_close.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/scanner/scan_bad_syscall_close.hay:1:1] Error: Expected `)` after `syscall`.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/scanner/scan_bad_syscall_number_too_large.hay: -------------------------------------------------------------------------------- 1 | syscall(7) -------------------------------------------------------------------------------- /src/tests/scanner/scan_bad_syscall_number_too_large.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/scanner/scan_bad_syscall_number_too_large.hay:1:1] Error: Expected `1..6` after `syscall(`, but found 7\n" 5 | } -------------------------------------------------------------------------------- /src/tests/scanner/scan_bad_syscall_number_too_small.hay: -------------------------------------------------------------------------------- 1 | syscall(0) -------------------------------------------------------------------------------- /src/tests/scanner/scan_bad_syscall_number_too_small.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/scanner/scan_bad_syscall_number_too_small.hay:1:1] Error: Expected `1..6` after `syscall(`, but found 0\n" 5 | } -------------------------------------------------------------------------------- /src/tests/scanner/scan_bad_syscall_open.hay: -------------------------------------------------------------------------------- 1 | syscall{1} -------------------------------------------------------------------------------- /src/tests/scanner/scan_bad_syscall_open.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/scanner/scan_bad_syscall_open.hay:1:1] Error: Expected `(` after `syscall`.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/scanner/scan_bad_syscall_parameter.hay: -------------------------------------------------------------------------------- 1 | syscall(foo) -------------------------------------------------------------------------------- /src/tests/scanner/scan_bad_syscall_parameter.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/scanner/scan_bad_syscall_parameter.hay:1:1] Error: Expected `1..6` after `syscall(`.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/scanner/scan_bad_u8.hay: -------------------------------------------------------------------------------- 1 | 256u8 -------------------------------------------------------------------------------- /src/tests/scanner/scan_bad_u8.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/scanner/scan_bad_u8.hay:1:1] Error: Failed to convert 256 into a `u8` literal\n" 5 | } -------------------------------------------------------------------------------- /src/tests/scanner/scan_good_escape_chars.hay: -------------------------------------------------------------------------------- 1 | '\n' 2 | '\t' 3 | '\r' -------------------------------------------------------------------------------- /src/tests/scanner/scan_good_escape_chars.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/scanner/scan_good_escape_chars.hay:1:1] Error: Unexpected top level token: `char`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/scanner/scan_multi_line_string.hay: -------------------------------------------------------------------------------- 1 | "Hello world 2 | I can parse this string" -------------------------------------------------------------------------------- /src/tests/scanner/scan_multi_line_string.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/scanner/scan_multi_line_string.hay:2:1] Error: Unexpected top level token: `Str`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/scanner/scan_special_functions.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | u64: bar 3 | 4 | impl: 5 | fn +Foo() {} 6 | fn -Foo() {} 7 | } 8 | -------------------------------------------------------------------------------- /src/tests/scanner/scan_special_functions.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/scanner/scan_special_functions.hay:1:1] Error: No entry point was found\n" 5 | } -------------------------------------------------------------------------------- /src/tests/scanner/scan_unexpected_char.hay: -------------------------------------------------------------------------------- 1 | 😂 -------------------------------------------------------------------------------- /src/tests/scanner/scan_unexpected_char.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/scanner/scan_unexpected_char.hay:1:1] Error: Unexpected character: `😂`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/scanner/scan_unterminated_char.hay: -------------------------------------------------------------------------------- 1 | 'unterminated char -------------------------------------------------------------------------------- /src/tests/scanner/scan_unterminated_char.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/scanner/scan_unterminated_char.hay:1:1] Error: Unterminated character\n" 5 | } -------------------------------------------------------------------------------- /src/tests/scanner/scan_unterminated_string.hay: -------------------------------------------------------------------------------- 1 | "This is an unterminated string -------------------------------------------------------------------------------- /src/tests/scanner/scan_unterminated_string.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/scanner/scan_unterminated_string.hay:1:1] Error: Unterminated string\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/associated_type_redefinition.hay: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | _: Output 3 | fn foo(A) -> [Output] 4 | } 5 | 6 | impl Foo { 7 | u64: Output 8 | u8: Output 9 | fn foo(u64) -> [u8] { drop 0u8} 10 | } -------------------------------------------------------------------------------- /src/tests/stmt/associated_type_redefinition.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/associated_type_redefinition.hay:8:5] Error: Associated type `Output` defined multiple times.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/bad_associated_type.hay: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | _: Output 3 | fn foo(T) -> [Output] 4 | } 5 | 6 | impl Foo { 7 | u64: output 8 | fn foo(u64) -> [u64] { } 9 | } -------------------------------------------------------------------------------- /src/tests/stmt/bad_associated_type.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/bad_associated_type.hay:7:5] Error: Unrecognized associated type: `output`\n [Note]: Interface `Foo` expects the following associated types:\n [Note]: [Output]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/blanket_impl_requirement_breach.hay: -------------------------------------------------------------------------------- 1 | interface MyPrint { 2 | fn my_print(T) 3 | } 4 | 5 | impl MyPrint { 6 | fn my_print(u64) { putlnu } 7 | } 8 | 9 | impl MyPrint<&T> 10 | requires: [MyPrint] 11 | { 12 | fn my_print(&T) { @ print } 13 | } 14 | 15 | fn main() { 16 | 17 | true as [b] 18 | &b my_print 19 | 20 | } -------------------------------------------------------------------------------- /src/tests/stmt/dangling_pre_declaration.hay: -------------------------------------------------------------------------------- 1 | struct Foo: 2 | struct Bar: 3 | struct Baz: -------------------------------------------------------------------------------- /src/tests/stmt/dangling_pre_declaration.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/dangling_pre_declaration.hay:2:1] Error: The following types were never declared:\n [src/tests/stmt/dangling_pre_declaration.hay:2:1]: Bar\n [src/tests/stmt/dangling_pre_declaration.hay:3:1]: Baz\n [src/tests/stmt/dangling_pre_declaration.hay:1:1]: Foo\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/enum_name_conflict.hay: -------------------------------------------------------------------------------- 1 | fn Foo() {} 2 | enum Foo { Bar } 3 | -------------------------------------------------------------------------------- /src/tests/stmt/enum_name_conflict.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/enum_name_conflict.hay:2:6] Error: Name conflict. `Foo` defined elsewhere\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/fn_name_conflict.hay: -------------------------------------------------------------------------------- 1 | struct Foo { u64: foo} 2 | fn Foo() {} -------------------------------------------------------------------------------- /src/tests/stmt/fn_name_conflict.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/fn_name_conflict.hay:2:4] Error: Function name conflict. `Foo` defined elsewhere\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/funcion_non_interface_requirement1.hay: -------------------------------------------------------------------------------- 1 | fn Foo() 2 | requires: [Str] { } -------------------------------------------------------------------------------- /src/tests/stmt/funcion_non_interface_requirement1.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/funcion_non_interface_requirement1.hay:2:12] Error: Invalid requirement: `Str` is not an interface.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/funcion_non_interface_requirement2.hay: -------------------------------------------------------------------------------- 1 | fn Foo() 2 | requires: [Arr] { } -------------------------------------------------------------------------------- /src/tests/stmt/funcion_non_interface_requirement2.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/funcion_non_interface_requirement2.hay:2:12] Error: Invalid requirement: `Arr` is not an interface.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/impl_non_interface_type.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | T: foo 3 | } 4 | 5 | impl Foo { 6 | 7 | } -------------------------------------------------------------------------------- /src/tests/stmt/impl_non_interface_type.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/impl_non_interface_type.hay:5:6] Error: Cannot implement `Foo`, as it is not an interface\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/impl_unknown_interface.hay: -------------------------------------------------------------------------------- 1 | impl Foo { 2 | 3 | } -------------------------------------------------------------------------------- /src/tests/stmt/impl_unknown_interface.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/impl_unknown_interface.hay:1:6] Error: Unrecognized interface: `Foo`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/impl_wrong_annotations.hay: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | fn foo() 3 | } 4 | 5 | impl Foo { 6 | 7 | } -------------------------------------------------------------------------------- /src/tests/stmt/impl_wrong_annotations.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/impl_wrong_annotations.hay:5:6] Error: Incorrect number of annotations for interface `Foo`\n [Note]: Expected annotations for: [A, B, C]\n [Note]: Found annotations: [u64]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/interface_name_conflict.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | u64: bar 3 | } 4 | 5 | interface Foo { 6 | fn foo(T) -> [T] 7 | } -------------------------------------------------------------------------------- /src/tests/stmt/interface_name_conflict.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/interface_name_conflict.hay:5:11] Error: Interface name conflict: `Foo` defined elsewhere.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/interface_non_interface_requirement1.hay: -------------------------------------------------------------------------------- 1 | interface Foo 2 | requires: [Str] { } -------------------------------------------------------------------------------- /src/tests/stmt/interface_non_interface_requirement1.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/interface_non_interface_requirement1.hay:2:12] Error: Invalid requirement: `Str` is not an interface.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/interface_non_interface_requirement2.hay: -------------------------------------------------------------------------------- 1 | interface Foo 2 | requires: [Arr] { } -------------------------------------------------------------------------------- /src/tests/stmt/interface_non_interface_requirement2.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/interface_non_interface_requirement2.hay:2:12] Error: Invalid requirement: `Arr` is not an interface.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/interface_reimpl.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/interface_reimpl.hay:12:6] Error: Interface Foo has already been implemented\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/interface_requirements.hay: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | fn foo(&T) -> [T] 3 | } 4 | 5 | interface Bar 6 | requires: [Foo Foo] 7 | {} 8 | 9 | impl Foo { 10 | fn foo(&u64) -> [u64] { @ } 11 | } 12 | 13 | impl Bar {} -------------------------------------------------------------------------------- /src/tests/stmt/interface_requirements.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/interface_requirements.hay:13:6] Error: Failed to implement Interface `Bar`\n [Note]: Interface `Bar` requires `Foo` is implemented\n [Note]: Interface `Foo` is not implemented\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/interface_signature_mismatch.hay: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | _: Output 3 | fn foo(T) -> [Output] 4 | } 5 | 6 | impl Foo { 7 | u8: Output 8 | fn foo(u64) -> [u64] { } 9 | } -------------------------------------------------------------------------------- /src/tests/stmt/interface_signature_mismatch.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/interface_signature_mismatch.hay:8:8] Error: Incorrect interface function signature\n [Note]: For interface function `foo`\n [Note]: Expected: [\"u64\"] -> [\"u8\"]\n [Note]: Found : [\"u64\"] -> [\"u64\"]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/missing_associated_types.hay: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | _: Output 3 | fn foo(T) -> [Output] 4 | } 5 | 6 | impl Foo { 7 | fn foo(u64) -> [u64] {} 8 | } -------------------------------------------------------------------------------- /src/tests/stmt/missing_associated_types.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/missing_associated_types.hay:6:6] Error: Missing interface associated types.\n [Note]: The following types were not defined for interface `Foo`:\n [Note]: * _: Output\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/missing_interface_impls.hay: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | fn foo(T) 3 | } 4 | 5 | impl Foo { 6 | } -------------------------------------------------------------------------------- /src/tests/stmt/missing_interface_impls.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/missing_interface_impls.hay:5:6] Error: Missing interface function implementations.\n [Note]: The following functions were not implemented for interface `Foo`:\n [Note]: * fn foo\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/non_generic_function_requirements.hay: -------------------------------------------------------------------------------- 1 | interface Foo {} 2 | impl Foo {} 3 | 4 | fn foo() 5 | requires: [Foo] {} -------------------------------------------------------------------------------- /src/tests/stmt/non_generic_function_requirements.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/non_generic_function_requirements.hay:5:12] Error: Cannot have interface requirements on non-generic functions\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/non_generic_record_requirements.hay: -------------------------------------------------------------------------------- 1 | interface Foo {} 2 | impl Foo {} 3 | 4 | struct Bar 5 | requires: [Foo] { 6 | u64: bar 7 | } -------------------------------------------------------------------------------- /src/tests/stmt/non_generic_record_requirements.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/non_generic_record_requirements.hay:5:12] Error: Cannot have interface requirements on a non-generic struct\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/pre_decl_name_conflict.hay: -------------------------------------------------------------------------------- 1 | enum Foo { 2 | Bar 3 | } 4 | 5 | struct Foo: -------------------------------------------------------------------------------- /src/tests/stmt/pre_decl_name_conflict.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/pre_decl_name_conflict.hay:5:8] Error: Name conflict: `Foo` defined elsewhere.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/pre_declare_generics_mismatch.hay: -------------------------------------------------------------------------------- 1 | struct Foo: 2 | 3 | struct Foo { 4 | u64: bar 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/pre_declare_generics_mismatch2.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | T: bar 3 | } 4 | 5 | struct Foo: -------------------------------------------------------------------------------- /src/tests/stmt/pre_declare_generics_mismatch3.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | T: bar 3 | } 4 | 5 | struct Foo: -------------------------------------------------------------------------------- /src/tests/stmt/pre_declare_generics_mismatch4.hay: -------------------------------------------------------------------------------- 1 | struct Foo: 2 | struct Foo { 3 | T: bar 4 | } -------------------------------------------------------------------------------- /src/tests/stmt/pre_declare_kind_mismatch.hay: -------------------------------------------------------------------------------- 1 | union Foo: 2 | 3 | struct Foo { 4 | u64: bar 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/pre_declare_kind_mismatch.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/pre_declare_kind_mismatch.hay:3:1] Error: Type Declaration doesn't match Pre-Declaration.\n [src/tests/stmt/pre_declare_kind_mismatch.hay:1:1]: Type Foo was predeclared as a union\n [src/tests/stmt/pre_declare_kind_mismatch.hay:3:1]: Type Foo was defined as a struct\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/pre_declare_kind_mismatch2.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | u64: bar 3 | } 4 | 5 | union Foo: -------------------------------------------------------------------------------- /src/tests/stmt/pre_declare_kind_mismatch2.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/pre_declare_kind_mismatch2.hay:5:1] Error: Type Declaration doesn't match Pre-Declaration.\n [src/tests/stmt/pre_declare_kind_mismatch2.hay:5:1]: Type Foo was predeclared as a union\n [src/tests/stmt/pre_declare_kind_mismatch2.hay:1:1]: Type Foo was defined as a struct\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/record_name_conflict.hay: -------------------------------------------------------------------------------- 1 | enum Foo { Bar } 2 | struct Foo { u64: bar} -------------------------------------------------------------------------------- /src/tests/stmt/record_name_conflict.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/record_name_conflict.hay:2:8] Error: Name conflict: `Foo` defined elsewhere.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/record_non_interface_requirement1.hay: -------------------------------------------------------------------------------- 1 | struct Foo 2 | requires: [Str] { 3 | T: t 4 | } -------------------------------------------------------------------------------- /src/tests/stmt/record_non_interface_requirement1.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/record_non_interface_requirement1.hay:2:12] Error: Invalid requirement: `Str` is not an interface.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/record_non_interface_requirement2.hay: -------------------------------------------------------------------------------- 1 | union Foo 2 | requires: [Arr] { 3 | T: t 4 | } -------------------------------------------------------------------------------- /src/tests/stmt/record_non_interface_requirement2.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/record_non_interface_requirement2.hay:2:12] Error: Invalid requirement: `Arr` is not an interface.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/unexpected_interface_function.hay: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | _: Output 3 | fn foo(T) -> [Output] 4 | } 5 | 6 | impl Foo { 7 | u64: Output 8 | fn foo(u64) -> [u64] {} 9 | fn bar() {} 10 | } -------------------------------------------------------------------------------- /src/tests/stmt/unexpected_interface_function.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/unexpected_interface_function.hay:9:5] Error: Unexpected interface function: `bar`\n [Note]: Interface `Foo` defines the following functions:\n [Note]: * fn foo\n" 5 | } -------------------------------------------------------------------------------- /src/tests/stmt/var_name_conflict.hay: -------------------------------------------------------------------------------- 1 | fn foo() {} 2 | var u64: foo -------------------------------------------------------------------------------- /src/tests/stmt/var_name_conflict.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/stmt/var_name_conflict.hay:2:1] Error: Var conflict. `foo` defined elsewhere\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/address_of_unknown_ident.hay: -------------------------------------------------------------------------------- 1 | fn main() { &foo } -------------------------------------------------------------------------------- /src/tests/type_check/address_of_unknown_ident.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/address_of_unknown_ident.hay:1:13] Error: Type Error: Can't take address of unknown identifier: `foo`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/annotated_unknown_function_call.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 10 foo:: drop 3 | } 4 | -------------------------------------------------------------------------------- /src/tests/type_check/annotated_unknown_function_call.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/annotated_unknown_function_call.hay:2:8] Error: Type Error: Unrecognized function `foo`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/annotations_on_non_generic_function.hay: -------------------------------------------------------------------------------- 1 | fn foo() {} 2 | 3 | fn main() { 4 | 5 | foo:: 6 | 7 | } -------------------------------------------------------------------------------- /src/tests/type_check/annotations_on_non_generic_function.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/annotations_on_non_generic_function.hay:5:5] Error: Type Error: Cannot provide annotations to non generic function `foo`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/anon_struct_bad_accessor1.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 1 cast({u64: n}) as [x] 3 | x::0 println 4 | } -------------------------------------------------------------------------------- /src/tests/type_check/anon_struct_bad_accessor1.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/anon_struct_bad_accessor1.hay:3:5] Error: Expected one of [\"n\"] to access into `{u64: n}`, but found `u64` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/anon_struct_bad_accessor2.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 1 cast({u64: n}) as [x] 3 | x::m println 4 | } -------------------------------------------------------------------------------- /src/tests/type_check/anon_struct_bad_accessor2.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/anon_struct_bad_accessor2.hay:3:5] Error: Expected one of [\"n\"] to access into `{u64: n}`, but found an identifier (m) instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/associated_type_unknown_interface.hay: -------------------------------------------------------------------------------- 1 | fn foo(Foo::Bar: _) {} -------------------------------------------------------------------------------- /src/tests/type_check/associated_type_unknown_interface.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/associated_type_unknown_interface.hay:1:8] Error: Unknown interface `Foo`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/associated_types.hay: -------------------------------------------------------------------------------- 1 | fn foo(u64 Add::Output) -> [Add::Output] { + } 2 | fn main() { 3 | 4 | 1 2 foo 5 | 6 | } -------------------------------------------------------------------------------- /src/tests/type_check/associated_types.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/associated_types.hay:2:4] Error: Type Error: Function `main` doesn't produce the correct outputs\n [Note]: Expected final stack: []\n [Note]: Function produced: [u64]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/associated_types_no_impl.hay: -------------------------------------------------------------------------------- 1 | fn bar(Add::Output) {} -------------------------------------------------------------------------------- /src/tests/type_check/associated_types_no_impl.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/associated_types_no_impl.hay:1:8] Error: Failed to find associated type Output for Add\n [Note]: Interface Add is not implemented for Add\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/bad_early_return.hay: -------------------------------------------------------------------------------- 1 | fn foo() -> [u64] { 2 | 3 | 1 2 3 4 5 return 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/bad_early_return.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/bad_early_return.hay:3:15] Error: Type Error: Early return type check failure.\n [Note]: Function `foo` expects return type(s): [u64]\n [Note]: Found the following stack: [u64, u64, u64, u64, u64]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/bad_interface_resolution.hay: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | fn foo(A) 3 | } 4 | 5 | impl Foo { 6 | fn foo(u64) { drop } 7 | } 8 | 9 | fn main() { 10 | "Hello" foo 11 | } -------------------------------------------------------------------------------- /src/tests/type_check/bad_interface_resolution.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/bad_interface_resolution.hay:10:13] Error: Type Error: Failed to resolve interface function `foo`\n [Note]: Interface `Foo` is implemented by:\n [Note]: Foo\n [Note]: Function `foo` expected:\n [Note]: [A]\n [Note]: Found:\n [Note]: [Str]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/bind_insufficient_elements.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | 1 2 3 as [a b c d] 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/bind_insufficient_elements.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/bind_insufficient_elements.hay:3:11] Error: Type Error: Insufficient elements on the stack to bind\n [Note]: Expected 4 elements to bind to idents: [\"a\", \"b\", \"c\", \"d\"]\n [Note]: Found: [u64, u64, u64]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_enum.hay: -------------------------------------------------------------------------------- 1 | enum Foo { 2 | Bar 3 | } 4 | 5 | fn main() { 6 | 7 | 1 cast(Foo) 8 | 9 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_enum.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/cast_enum.hay:7:7] Error: Type Error: Casting to enums is unsupported.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_enum_struct.hay: -------------------------------------------------------------------------------- 1 | enum struct Foo { u64: Bar} 2 | 3 | fn main() { 4 | cast(Foo) 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_enum_struct.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/cast_enum_struct.hay:4:5] Error: Cannot cast to enum struct base: `Foo`\n [Note]: Cast to one of the following variants instead:\n [Note]: - Foo::Bar\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_enum_struct_generic.hay: -------------------------------------------------------------------------------- 1 | enum struct Foo { 2 | T: Bar 3 | } 4 | 5 | fn main() { 6 | cast(Foo) 7 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_enum_struct_generic.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/cast_enum_struct_generic.hay:6:5] Error: Cannot cast to enum struct base: `Foo`\n [Note]: Cast to one of the following variants instead:\n [Note]: - Foo::Bar\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_generic_struct_instance.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | pub T: foo 3 | } 4 | 5 | 6 | fn main() { 7 | 8 | 1 cast(Foo) 9 | 10 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_generic_struct_instance.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/cast_generic_struct_instance.hay:8:7] Error: Type Error: Invalid inputs for `cast(Foo)`\n [Note]: Expected: [bool]\n [Note]: Found: [u64]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_to_generic_struct_with_private_members.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | T: bar 3 | } 4 | 5 | fn main() { 6 | 1 cast(Foo) 7 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_to_generic_struct_with_private_members.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/cast_to_generic_struct_with_private_members.hay:6:7] Error: Cannot cast to type `Foo` because it has private members.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_to_generic_struct_with_private_members_in_impl.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | T: bar 3 | } 4 | 5 | struct Bar { 6 | u64: baz 7 | impl: 8 | fn Bar.Quxx() { 9 | 1 cast(Foo) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/tests/type_check/cast_to_generic_struct_with_private_members_in_impl.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/cast_to_generic_struct_with_private_members_in_impl.hay:9:11] Error: Cannot cast to type `Foo` because it has private members.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_to_generic_union.hay: -------------------------------------------------------------------------------- 1 | union Foo { 2 | u64: n 3 | bool: b 4 | T: t 5 | } 6 | 7 | fn main() { 8 | { 9 | "Hello World" cast(Foo) as [f] 10 | f::t println 11 | } 12 | { 13 | 12345 cast(Foo) as [f] 14 | f::n println 15 | } 16 | { 17 | true cast(Foo) as [f] 18 | f::b println 19 | } 20 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_to_generic_union.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/type_check/cast_to_generic_union.asm\n[CMD]: ld -o cast_to_generic_union src/tests/type_check/cast_to_generic_union.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_to_generic_union.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "Hello World\n12345\ntrue\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_to_struct_with_private_members.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | u64: bar 3 | } 4 | 5 | fn main() { 6 | 1 cast(Foo) 7 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_to_struct_with_private_members.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/cast_to_struct_with_private_members.hay:6:7] Error: Cannot cast to type `Foo` because it has private members.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_to_struct_with_private_members_in_impl.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | u64: bar 3 | } 4 | 5 | struct Bar { 6 | u64: baz 7 | impl: 8 | fn Bar.Quxx() { 9 | 1 cast(Foo) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/tests/type_check/cast_to_struct_with_private_members_in_impl.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/cast_to_struct_with_private_members_in_impl.hay:9:11] Error: Cannot cast to type `Foo` because it has private members.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_u8.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | 1 cast(u8) println 4 | 2u8 cast(u8) println 5 | true cast(u8) println 6 | 'c' cast(u8) println 7 | 8 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_u8.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "[CMD]: nasm -felf64 src/tests/type_check/cast_u8.asm\n[CMD]: ld -o cast_u8 src/tests/type_check/cast_u8.o\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_u8.try_run: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 0, 3 | "stdout": "1\n2\n1\n99\n", 4 | "stderr": "" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_variant.hay: -------------------------------------------------------------------------------- 1 | enum Foo {Bar Baz} 2 | 3 | fn main() { 4 | 5 | 0 cast(Foo::Bar) 6 | 7 | } -------------------------------------------------------------------------------- /src/tests/type_check/cast_variant.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/cast_variant.hay:5:7] Error: Type Error: Casting to non-enum-struct variant is unsupported\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/destructure_non_tuple.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | 1 2 as [[one two] three] 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/destructure_non_tuple.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/destructure_non_tuple.hay:3:14] Error: Type Error: Non-tuple type `u64` cannot be destructured\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/destructure_wrong_number_idents.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | [1 2] as [[one two three]] 3 | } -------------------------------------------------------------------------------- /src/tests/type_check/destructure_wrong_number_idents.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/destructure_wrong_number_idents.hay:2:16] Error: Type Error: Incorrect number of arguments to destructure tuple\n [Note]: Found idents: [\"one\", \"two\", \"three\"]\n [Note]: For Tuple of type: [u64 u64]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_bad_variant.hay: -------------------------------------------------------------------------------- 1 | enum Foo { 2 | Bar 3 | Baz 4 | } 5 | 6 | fn takes_bar(Foo::Bar: foo) {} 7 | fn main() { 8 | Foo::Baz takes_bar 9 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_bad_variant.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/enum_bad_variant.hay:8:14] Error: Type Error: Invalid inputs for `takes_bar`\n [Note]: Expected: [Foo::Bar]\n [Note]: Found: [Foo::Baz]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_bad_variant2.hay: -------------------------------------------------------------------------------- 1 | enum Foo { 2 | Bar 3 | Baz 4 | } 5 | 6 | fn return_foo() -> [Foo] { 7 | Foo::Bar 8 | } 9 | 10 | fn takes_baz(Foo::Baz: x) {} 11 | 12 | fn main() { 13 | return_foo takes_baz 14 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_bad_variant2.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/enum_bad_variant2.hay:13:16] Error: Type Error: Invalid inputs for `takes_baz`\n [Note]: Expected: [Foo::Baz]\n [Note]: Found: [Foo]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_compare.hay: -------------------------------------------------------------------------------- 1 | enum Foo { 2 | Bar 3 | Baz 4 | } 5 | 6 | fn main() { 7 | 8 | Foo::Bar Foo::Baz == println 9 | Foo::Bar Foo::Baz != println 10 | 11 | 0 Foo::Bar != println 12 | 13 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_enum_resolution.hay: -------------------------------------------------------------------------------- 1 | enum Foo { 2 | a 3 | b 4 | c 5 | } 6 | enum Bar { 7 | a 8 | b 9 | c 10 | } 11 | 12 | fn foo(T Foo) { drop drop } 13 | fn main() { 14 | 15 | 1 Bar::a foo 16 | 17 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_enum_resolution.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/enum_enum_resolution.hay:15:14] Error: Failed to resolve enum type `Foo` from `Bar`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_multiple_inner_access.hay: -------------------------------------------------------------------------------- 1 | enum Foo { 2 | Bar, 3 | Baz 4 | } 5 | 6 | fn main() { 7 | 8 | Foo::Bar::Baz 9 | 10 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_multiple_inner_access.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/enum_multiple_inner_access.hay:8:5] Error: Cannot have multiple inner accessor for an enum type.\n [Note]: Found accessors: [\"Bar\", \"Baz\"]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_struct_generic_base_fn_sig.hay: -------------------------------------------------------------------------------- 1 | enum struct Foo { 2 | T: Bar 3 | []: Baz 4 | } 5 | 6 | fn fizz(Foo::Bar) -> [Foo::Bar] { } -------------------------------------------------------------------------------- /src/tests/type_check/enum_struct_generic_base_fn_sig.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/enum_struct_generic_base_fn_sig.hay:6:9] Error: Enum struct `Foo` is generic, and requires annotations.\n [Note]: Consider using `Foo<...>::Bar`.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_struct_multiple_inner.hay: -------------------------------------------------------------------------------- 1 | enum struct Foo { u64: Bar } 2 | 3 | fn main() { 4 | 5 | Foo::Bar::Baz 6 | 7 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_struct_multiple_inner.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/enum_struct_multiple_inner.hay:5:5] Error: Cannot have multiple inner accessor for an enum struct type.\n [Note]: Found accessors: [\"Bar\", \"Baz\"]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_struct_require_cast.hay: -------------------------------------------------------------------------------- 1 | enum struct Foo { u64: Bar } 2 | 3 | fn main() { 4 | Foo::Bar 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_struct_require_cast.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/enum_struct_require_cast.hay:4:5] Error: Enum struct `Foo` variant `Bar` requires a cast\n [Note]: Variant `Bar` has a type u64.\n [Note]: Try using `cast(Foo::Bar)` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_struct_require_generics.hay: -------------------------------------------------------------------------------- 1 | enum struct Foo { T: Bar } 2 | 3 | fn main() { 4 | Foo::Bar 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_struct_require_generics.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/enum_struct_require_generics.hay:4:5] Error: Cannot create instance instance of generic type `Foo` without annotations.\n [Note]: `Foo` is generic over [T]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_struct_unknown_variant.hay: -------------------------------------------------------------------------------- 1 | enum struct Foo { u64: Bar } 2 | 3 | fn main() { 4 | Foo::Baz 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_struct_unknown_variant.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/enum_struct_unknown_variant.hay:4:5] Error: Unknown enum struct variant `Baz`\n [Note]: Enum struct `Foo` has variants: [\"Bar\"]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_unknown_variant.hay: -------------------------------------------------------------------------------- 1 | enum Foo { 2 | Bar 3 | } 4 | 5 | fn main() { 6 | Foo::Baz 7 | } -------------------------------------------------------------------------------- /src/tests/type_check/enum_unknown_variant.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/enum_unknown_variant.hay:6:5] Error: Unknown enum variant `Baz`\n [Note]: Enum Foo has variants: [\"Bar\"]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/function_requirements.hay: -------------------------------------------------------------------------------- 1 | interface Foo{ 2 | fn foo(T) -> [T] {} 3 | } 4 | 5 | impl Foo {} 6 | 7 | fn takes_foos(A B) -> [B A] 8 | requires: [Foo Foo] 9 | { 10 | foo swap foo 11 | } 12 | 13 | fn main() { 14 | 15 | 123 123u8 takes_foos drop drop 16 | 17 | } -------------------------------------------------------------------------------- /src/tests/type_check/function_requirements.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/function_requirements.hay:15:15] Error: Cannot call function `takes_foos` with inputs [u64, u8], as requirements are not met.\n [Note]: Function `takes_foos` requires `Foo` is implemented\n [Note]: Interface `Foo` is not implemented\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/generic_record_record_resolution.hay: -------------------------------------------------------------------------------- 1 | fn foo(Arr) { drop } 2 | fn main() { 3 | 4 | "Hello World" foo 5 | 6 | } -------------------------------------------------------------------------------- /src/tests/type_check/generic_record_record_resolution.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/generic_record_record_resolution.hay:4:19] Error: Cannot resolve struct `Arr` from `Str`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/generic_record_size.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | T: first 3 | T: second 4 | } 5 | 6 | fn main() { 7 | 8 | sizeOf(Foo) drop 9 | 10 | } -------------------------------------------------------------------------------- /src/tests/type_check/generic_record_size.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[:0:0] Error: Generic Records do not have a size known at compile time\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/if_block_different_stacks.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | true if { 4 | 1 5 | } else false if { 6 | true 7 | } else { 8 | "Hello World" 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /src/tests/type_check/if_else_push_between_conditions.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | false if { 4 | "a" 5 | } else 1 2 3 4 5 true if { 6 | "b" 7 | } else { 8 | "c" 9 | } 10 | 11 | drop 12 | 13 | } -------------------------------------------------------------------------------- /src/tests/type_check/if_no_else_modify_stack.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | true if { 4 | 1 5 | } 6 | 7 | } -------------------------------------------------------------------------------- /src/tests/type_check/immutable_pointer_write.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | "Hello World" as [s] 4 | 'M' s::data ! 5 | 6 | } -------------------------------------------------------------------------------- /src/tests/type_check/immutable_pointer_write.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/immutable_pointer_write.hay:4:17] Error: Type Error: Invalid inputs for `!`\n [Note]: Expected: [char, *char]\n [Note]: Found: [char, &char]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/incorrect_fn_signature.hay: -------------------------------------------------------------------------------- 1 | fn foo(u64) {} 2 | -------------------------------------------------------------------------------- /src/tests/type_check/incorrect_fn_signature.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/incorrect_fn_signature.hay:1:4] Error: Type Error: Function `foo` doesn't produce the correct outputs\n [Note]: Expected final stack: []\n [Note]: Function produced: [u64]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/inner_address_of_no_member.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | pub u64: bar 3 | } 4 | 5 | fn main() { 6 | 7 | 12345 cast(Foo) as [foo] 8 | &foo::baz 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/tests/type_check/inner_address_of_no_member.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/inner_address_of_no_member.hay:8:5] Error: Type Error: Struct `Foo` doesn't have a member `baz`\n [Note]: `Foo` has the following members: [\"bar\"]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/inner_address_of_non_record_type.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | 12345 as [foo] 4 | &foo::bar 5 | 6 | } -------------------------------------------------------------------------------- /src/tests/type_check/inner_address_of_non_record_type.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/inner_address_of_non_record_type.hay:4:5] Error: Cannot access into non-record type `u64`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/inner_address_of_private_member.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | u64: bar 3 | impl: 4 | fn Foo.new(u64) -> [Foo] { cast(Foo) } 5 | } 6 | 7 | fn main() { 8 | 9 | 12345 Foo.new as [foo] 10 | &foo::bar @ drop 11 | 12 | } -------------------------------------------------------------------------------- /src/tests/type_check/inner_address_of_private_member.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/inner_address_of_private_member.hay:10:5] Error: Type Error: Cannot access struct `Foo` member `bar` as it is declared as private.\n [src/tests/type_check/inner_address_of_private_member.hay:1:8]: struct `Foo` declared here\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/inner_address_of_private_member_in_impl.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | u64: bar 3 | } 4 | 5 | struct Bar { 6 | u64: baz 7 | impl: 8 | fn boom(Foo: foo) { 9 | &foo::bar @ drop 10 | } 11 | } -------------------------------------------------------------------------------- /src/tests/type_check/inner_address_of_private_member_in_impl.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/inner_address_of_private_member_in_impl.hay:9:9] Error: Type Error: Cannot access struct `Foo` member `bar` as it is declared as private.\n [src/tests/type_check/inner_address_of_private_member_in_impl.hay:1:8]: struct `Foo` declared here\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/interface_instance_concrete.hay: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | fn foo(T) -> [T] 3 | } 4 | 5 | fn Bar(Foo) -> [u64] { foo } -------------------------------------------------------------------------------- /src/tests/type_check/interface_instance_concrete.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/interface_instance_concrete.hay:5:8] Error: Cannot create an instance of interface `Foo`\n [Note]: Consider adding a `requires` block.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/interface_instance_generic.hay: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | fn foo(T) -> [T] 3 | } 4 | 5 | fn Bar(Foo) -> [T] { foo } -------------------------------------------------------------------------------- /src/tests/type_check/interface_instance_generic.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/interface_instance_generic.hay:5:11] Error: Cannot create an instance of interface `Foo`\n [Note]: Consider adding a `requires` block.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/match_bad_type.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 1 match { 3 | 4 | } 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/match_bad_type.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/match_bad_type.hay:2:7] Error: `match` expects an `enum struct`, but found `u64` instead\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/match_else_case.hay: -------------------------------------------------------------------------------- 1 | enum struct Foo { 2 | []: Bar 3 | u64: Baz 4 | } 5 | 6 | fn main() { 7 | 8 | Foo::Bar match { 9 | Foo::Bar { 1 } 10 | else { } 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /src/tests/type_check/match_empty.hay: -------------------------------------------------------------------------------- 1 | enum struct Foo { 2 | []: Bar 3 | []: Baz 4 | } 5 | 6 | fn main() { 7 | Foo::Bar match { 8 | 9 | } 10 | } -------------------------------------------------------------------------------- /src/tests/type_check/match_empty.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/match_empty.hay:7:14] Error: Empty match block handles no cases of enum-struct `Foo`\n [Note]: The following cases were not handled:\n [Note]: - Foo::Bar\n [Note]: - Foo::Baz\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/match_empty_stack.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | match {} 3 | } -------------------------------------------------------------------------------- /src/tests/type_check/match_empty_stack.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/match_empty_stack.hay:2:5] Error: `match` expects one element on the stack. Found none.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/match_mismatched_bases.hay: -------------------------------------------------------------------------------- 1 | enum struct Foo { []: A } 2 | enum struct Bar { []: B } 3 | 4 | fn main() { 5 | Foo::A match { 6 | Foo::A {} 7 | Bar::B {} 8 | } 9 | } -------------------------------------------------------------------------------- /src/tests/type_check/match_mismatched_bases.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/match_mismatched_bases.hay:7:9] Error: Bar::B is not a variant of Foo\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/match_non_exhaustive.hay: -------------------------------------------------------------------------------- 1 | enum struct Foo { 2 | u64: Bar 3 | Str: Baz 4 | []: Buzz 5 | } 6 | 7 | fn main() { 8 | 9 | 1 cast(Foo::Bar) match { 10 | Foo::Bar as [bar] { b println } 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /src/tests/type_check/match_non_exhaustive.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/match_non_exhaustive.hay:9:22] Error: Match expression doesn't handle all cases for enum-struct `Foo`\n [Note]: The following cases are not handled:\n [Note]: - Foo::Baz\n [Note]: - Foo::Buzz\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/match_non_variant_case.hay: -------------------------------------------------------------------------------- 1 | enum struct Foo { 2 | []: Bar 3 | } 4 | 5 | fn main() { 6 | Foo::Bar match { 7 | Foo::Bar {} 8 | u64 {} 9 | } 10 | } -------------------------------------------------------------------------------- /src/tests/type_check/match_non_variant_case.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/match_non_variant_case.hay:8:9] Error: `match` case expected a variant of `Foo`.\n [Note]: Found type `u64` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/match_unknown_type_case.hay: -------------------------------------------------------------------------------- 1 | enum struct Foo { 2 | []: Bar 3 | } 4 | 5 | fn main() { 6 | Foo::Bar match { 7 | Foo::Bar {} 8 | x {} 9 | } 10 | } -------------------------------------------------------------------------------- /src/tests/type_check/match_unknown_type_case.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/match_unknown_type_case.hay:8:9] Error: Unrecognized type: x\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/multiple_pointer_offsets.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | pub u64: bar 3 | pub bool: baz 4 | } 5 | 6 | struct Bar { 7 | pub *Foo: foo_p 8 | } 9 | 10 | fn work(&Bar: bar) { 11 | bar::foo_p::bar @ println 12 | bar::foo_p::baz @ println 13 | } 14 | 15 | fn main() { 16 | 17 | 12345 true cast(Foo) as [mut foo] 18 | *foo cast(Bar) as [bar] 19 | &bar work 20 | 21 | } -------------------------------------------------------------------------------- /src/tests/type_check/multiple_pointer_offsets.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/multiple_pointer_offsets.hay:11:5] Error: Cannot access into non-record type `*Foo`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/mutable_pointer_to_immutable_fn_arg.hay: -------------------------------------------------------------------------------- 1 | fn foo(u64: n) { 2 | 5 *n ! 3 | } 4 | 5 | fn main() { 6 | 7 | 0 foo 8 | 9 | } -------------------------------------------------------------------------------- /src/tests/type_check/mutable_pointer_to_immutable_fn_arg.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/mutable_pointer_to_immutable_fn_arg.hay:2:7] Error: Type Error: Cannot take mutable reference to immutable ident: `n`\n [src/tests/type_check/mutable_pointer_to_immutable_fn_arg.hay:1:8]: Consider adding `mut` in binding of `n`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/mutable_pointer_to_immutable_framed.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | 1234 as [n] { 4 | *n drop 5 | } 6 | } -------------------------------------------------------------------------------- /src/tests/type_check/mutable_pointer_to_immutable_framed.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/mutable_pointer_to_immutable_framed.hay:4:9] Error: Type Error: Cannot take mutable reference to immutable ident: `n`\n [src/tests/type_check/mutable_pointer_to_immutable_framed.hay:3:14]: Consider adding `mut` in binding of `n`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/mutable_pointer_to_immutable_framed_inner.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | "Hello World" as [s] { 3 | *s::size drop 4 | } 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/mutable_pointer_to_immutable_framed_inner.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/mutable_pointer_to_immutable_framed_inner.hay:3:9] Error: Type Error: Cannot take mutable reference to immutable ident: `s`\n [src/tests/type_check/mutable_pointer_to_immutable_framed_inner.hay:2:23]: Consider adding `mut` in binding of `s`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/never_type.hay: -------------------------------------------------------------------------------- 1 | fn foo() -> [!] { 2 | 1 3 | } -------------------------------------------------------------------------------- /src/tests/type_check/never_type.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/never_type.hay:1:4] Error: Type Error: Function `foo` doesn't produce the correct outputs\n [Note]: Expected final stack: [!]\n [Note]: Function produced: [u64]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/never_type_input.hay: -------------------------------------------------------------------------------- 1 | fn foo(!) { } -------------------------------------------------------------------------------- /src/tests/type_check/never_type_input.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/never_type_input.hay:1:8] Error: The Never type `!` isn't a valid input to function `foo`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/non_record_accessor.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | 1 as [foo] 4 | foo::data 5 | 6 | } -------------------------------------------------------------------------------- /src/tests/type_check/non_record_accessor.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/non_record_accessor.hay:4:5] Error: Type Error: Cannot access into non-record type `u64`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/ops_after_return.hay: -------------------------------------------------------------------------------- 1 | fn foo() -> [u64 u64] { 2 | 1 2 return + 3 | } 4 | 5 | fn main() { 6 | 7 | foo println println 8 | 9 | } -------------------------------------------------------------------------------- /src/tests/type_check/ops_after_return.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/ops_after_return.hay:2:16] Error: Unreachable expression.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/pointer_supertype_resolution.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | 0 as [mut n] 4 | 5 | 12345 false if { 6 | &n 7 | } else { 8 | *n 9 | } ! 10 | 11 | } -------------------------------------------------------------------------------- /src/tests/type_check/pointer_supertype_resolution.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/pointer_supertype_resolution.hay:9:7] Error: Type Error: Invalid inputs for `!`\n [Note]: Expected: [u64, *u64]\n [Note]: Found: [u64, &u64]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/private_member_access.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | u64: bar 3 | impl: 4 | fn Foo.new(u64) -> [Foo] { cast(Foo) } 5 | } 6 | 7 | fn main() { 8 | 9 | 1234 Foo.new as [f] 10 | f::bar drop 11 | 12 | } -------------------------------------------------------------------------------- /src/tests/type_check/private_member_access.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/private_member_access.hay:10:5] Error: Type Error: Cannot access struct `Foo` member `bar` as it is declared as private.\n [src/tests/type_check/private_member_access.hay:1:8]: struct `Foo` declared here\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/private_member_access_in_impl.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | u64: bar 3 | impl: 4 | fn Foo.new(u64) -> [Foo] { cast(Foo) } 5 | } 6 | 7 | struct Baz { 8 | u64: buzz 9 | impl: 10 | fn do_work() { 11 | 12345 Foo.new as [f] 12 | f::bar drop 13 | } 14 | } -------------------------------------------------------------------------------- /src/tests/type_check/private_member_access_in_impl.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/private_member_access_in_impl.hay:12:9] Error: Type Error: Cannot access struct `Foo` member `bar` as it is declared as private.\n [src/tests/type_check/private_member_access_in_impl.hay:1:8]: struct `Foo` declared here\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/record_record_resolution.hay: -------------------------------------------------------------------------------- 1 | 2 | fn foo(T Arr) { drop drop } 3 | 4 | fn main() { 5 | 6 | 1 "Hello World" foo 7 | 8 | } -------------------------------------------------------------------------------- /src/tests/type_check/record_record_resolution.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/record_record_resolution.hay:6:21] Error: Type Error: Cannot resolve struct `Arr` from `Str`.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/size_of_unknown_type.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | sizeOf(T) 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/size_of_unknown_type.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/size_of_unknown_type.hay:3:5] Error: Type Error: Cannot get the size of unknown type T\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/size_of_unknown_type_generic.hay: -------------------------------------------------------------------------------- 1 | fn foo() -> [u64] { sizeOf(X) } 2 | fn main() { 3 | 4 | foo:: drop 5 | 6 | } -------------------------------------------------------------------------------- /src/tests/type_check/size_of_unknown_type_generic.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/size_of_unknown_type_generic.hay:1:24] Error: Type Error: Cannot get size of unknown type: X\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/struct_accessor_without_member.hay: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | u64: bar 3 | impl: 4 | fn Foo.new(u64) -> [Foo] { cast(Foo) } 5 | } 6 | 7 | fn main() { 8 | 9 | 12345 Foo.new as [foo] 10 | 11 | foo::bad println 12 | 13 | } -------------------------------------------------------------------------------- /src/tests/type_check/struct_accessor_without_member.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/struct_accessor_without_member.hay:11:5] Error: Type Error: Struct `Foo` doesn't have a member `bad`\n [Note]: `Foo` has the following members: [\"bar\"]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/struct_requirements.hay: -------------------------------------------------------------------------------- 1 | interface Marker {} 2 | 3 | impl Marker {} 4 | 5 | struct Marked 6 | requires: [Marker Marker] { 7 | pub A: a 8 | pub B: b 9 | } 10 | 11 | fn main() { 12 | 13 | 12345 0u8 cast(Marked) drop 14 | 15 | } -------------------------------------------------------------------------------- /src/tests/type_check/struct_requirements.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/struct_requirements.hay:13:15] Error: Cannot assign [u64, u8] to struct `Marked`, as requirements would not be met.\n [Note]: Struct `Marked` requires `Marker` is implemented\n [Note]: Interface `Marker` is not implemented\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/syscall_bad_number_of_args.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | 1 1 1 syscall(3) 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/syscall_bad_number_of_args.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/syscall_bad_number_of_args.hay:3:11] Error: Type Error: syscall(3) requires at least 4 elements on the stack. Found 3\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/syscall_wrong_sized_types.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | "Hello World" 0 syscall(1) 4 | 5 | 6 | } -------------------------------------------------------------------------------- /src/tests/type_check/syscall_wrong_sized_types.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/syscall_wrong_sized_types.hay:3:21] Error: `syscall(1)` can only accept types of size 1.\n [Note]: Found type `Str` which has size 2\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/union_accessor_without_member.hay: -------------------------------------------------------------------------------- 1 | union Foo{ 2 | u64: bar 3 | } 4 | 5 | fn main() { 6 | 7 | 12345 cast(Foo) as [foo] foo::bad 8 | 9 | } -------------------------------------------------------------------------------- /src/tests/type_check/union_accessor_without_member.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/union_accessor_without_member.hay:7:30] Error: Type Error: Union `Foo` doesn't have a member `bad`\n [Note]: `Foo` has the following members: [\"bar\"]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/union_requirements.hay: -------------------------------------------------------------------------------- 1 | interface Marker {} 2 | 3 | impl Marker {} 4 | 5 | union Marked 6 | requires: [Marker Marker] { 7 | A: a 8 | B: b 9 | } 10 | 11 | fn main() { 12 | 13 | 0u8 cast(Marked) drop 14 | 15 | } -------------------------------------------------------------------------------- /src/tests/type_check/union_requirements.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/union_requirements.hay:13:14] Error: Cannot assign [u64, u8] to union `Marked`, as requirements would not be met.\n [Note]: Union `Marked` requires `Marker` is implemented\n [Note]: Interface `Marker` is not implemented\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/unknown_accessor_ident.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | Foo::Bar 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/unknown_accessor_ident.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/unknown_accessor_ident.hay:3:5] Error: Unknown identifier `Foo`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/unknown_associated_type.hay: -------------------------------------------------------------------------------- 1 | fn foo(Add::Bar: x ){} -------------------------------------------------------------------------------- /src/tests/type_check/unknown_associated_type.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/unknown_associated_type.hay:1:13] Error: Unrecognized associated type: `Bar`\n [Note]: Interface `Add` has the following associated types:\n [Note]: [Output]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/unpack_empty_stack.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | unpack 3 | } -------------------------------------------------------------------------------- /src/tests/type_check/unpack_empty_stack.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/unpack_empty_stack.hay:2:5] Error: `Unpack` expression requires a tuple on top of the stack, but stack was empty\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/unpack_non_tuple.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | "Hello World" unpack 3 | } -------------------------------------------------------------------------------- /src/tests/type_check/unpack_non_tuple.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/unpack_non_tuple.hay:2:19] Error: `Unpack` expression requires a tuple on top of the stack, found `Str` instead.\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/unrecognized_ident.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | foo 3 | } -------------------------------------------------------------------------------- /src/tests/type_check/unrecognized_ident.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/unrecognized_ident.hay:2:5] Error: Type Error: Unrecognized word `foo`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/unresolved_generics_in_annotated_call.hay: -------------------------------------------------------------------------------- 1 | fn foo() {} 2 | 3 | fn main() { 4 | 5 | foo:: 6 | 7 | } -------------------------------------------------------------------------------- /src/tests/type_check/unresolved_generics_in_annotated_call.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/unresolved_generics_in_annotated_call.hay:5:5] Error: Type Error: Unresolved generic types in annotations\n [Note]: Found annotations: [\"T1\"]\n [Note]: Of which: [\"T1\"] are generic\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/var_unknown_type.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | var foo: bar 4 | 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/var_unknown_type.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/var_unknown_type.hay:3:9] Error: Unrecognized type: foo\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/variant_bad_resolve.hay: -------------------------------------------------------------------------------- 1 | enum A_ { a1 a2 } 2 | 3 | fn foo(A_::a1: _ T: _) {} 4 | 5 | fn main() { 6 | 0 0 foo 7 | } -------------------------------------------------------------------------------- /src/tests/type_check/variant_bad_resolve.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/variant_bad_resolve.hay:6:9] Error: Type Error: Cannot resolve A_::a1 from u64\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/variant_resolve_bad_bases.hay: -------------------------------------------------------------------------------- 1 | enum A_ { a1 a2 } 2 | enum B_ { b1 b2 } 3 | 4 | fn foo(A_::a1: _ T: _) {} 5 | 6 | fn main() { 7 | A_::a1 0 foo 8 | B_::b1 0 foo 9 | } -------------------------------------------------------------------------------- /src/tests/type_check/variant_resolve_bad_bases.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/variant_resolve_bad_bases.hay:8:14] Error: Failed to resolve enum type `A_` from `B_`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/variant_resolve_bad_variant.hay: -------------------------------------------------------------------------------- 1 | enum A_ { a1 a2 } 2 | 3 | fn foo(A_::a1: _ T: _) {} 4 | 5 | fn main() { 6 | A_::a1 0 foo 7 | A_::a2 0 foo 8 | } -------------------------------------------------------------------------------- /src/tests/type_check/variant_resolve_bad_variant.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/variant_resolve_bad_variant.hay:7:14] Error: Cannot resolve variant `A_::a1` from `A_::a2`\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/while_changes_frame.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | while true as [b] b do { } 3 | } -------------------------------------------------------------------------------- /src/tests/type_check/while_changes_frame.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/while_changes_frame.hay:2:5] Error: Type Error: Frame cannot change within the while loop condition.\n [Note]: Frame Before: []\n [Note]: Frame After : [b: bool]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/while_changes_stack.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | while true do { 4 | 1 5 | } 6 | 7 | } -------------------------------------------------------------------------------- /src/tests/type_check/while_changes_stack.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/while_changes_stack.hay:3:5] Error: While loop must not change stack between iterations.\n [Note]: Stack before loop: []\n [Note]: Stack after loop: [u64]\n" 5 | } -------------------------------------------------------------------------------- /src/tests/type_check/while_loop_push_before_condition.hay: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | Vec.new:: as [mut vec] 4 | 5 | while *vec Vec.pop dup Option.take_is_some do { 6 | drop 7 | } 8 | 9 | 10 | } -------------------------------------------------------------------------------- /src/tests/type_check/while_loop_push_before_condition.try_com: -------------------------------------------------------------------------------- 1 | { 2 | "exit_code": 1, 3 | "stdout": "", 4 | "stderr": "[src/tests/type_check/while_loop_push_before_condition.hay:1:4] Error: Type Error: Function `main` doesn't produce the correct outputs\n [Note]: Expected final stack: []\n [Note]: Function produced: [Option]\n" 5 | } -------------------------------------------------------------------------------- /src/types/interface/mod.rs: -------------------------------------------------------------------------------- 1 | mod associated_type; 2 | mod base; 3 | mod instance; 4 | 5 | pub use associated_type::*; 6 | pub use base::*; 7 | pub use instance::*; 8 | -------------------------------------------------------------------------------- /src/types/variant.rs: -------------------------------------------------------------------------------- 1 | use crate::types::TypeId; 2 | 3 | #[derive(Debug, Clone)] 4 | pub struct VariantType { 5 | pub base: TypeId, 6 | pub variant: String, 7 | } 8 | -------------------------------------------------------------------------------- /std/assert.hay: -------------------------------------------------------------------------------- 1 | fn assert(bool) { 2 | lnot if { 3 | "Assertion failed" println 4 | 1 exit 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /std/builtin/prelude.hay: -------------------------------------------------------------------------------- 1 | include "std/builtin/bool.hay" 2 | include "std/builtin/char.hay" 3 | include "std/builtin/ptr.hay" 4 | include "std/builtin/u8.hay" 5 | include "std/builtin/u64.hay" -------------------------------------------------------------------------------- /std/builtin/ptr.hay: -------------------------------------------------------------------------------- 1 | fn ptr+(*T: ptr u64: n) -> [*T] { 2 | ptr cast(u64) sizeOf(T) n * + cast(*T) 3 | } 4 | fn mut_ptr+(&T: ptr u64: n) -> [&T] { 5 | ptr cast(u64) sizeOf(T) n * + cast(&T) 6 | } 7 | -------------------------------------------------------------------------------- /std/fmt/fmt.hay: -------------------------------------------------------------------------------- 1 | struct String: 2 | interface Format { 3 | fn fmt(String T) -> [String] 4 | } -------------------------------------------------------------------------------- /std/fmt/prelude.hay: -------------------------------------------------------------------------------- 1 | 2 | include "std/fmt/fmt.hay" 3 | include "std/fmt/to_string.hay" 4 | include "std/fmt/write.hay" -------------------------------------------------------------------------------- /std/fmt/to_string.hay: -------------------------------------------------------------------------------- 1 | struct String: 2 | interface ToString { 3 | fn to_string(T) -> [String] 4 | } -------------------------------------------------------------------------------- /std/fmt/write.hay: -------------------------------------------------------------------------------- 1 | interface Write { 2 | fn write(T: to_write u64: file_descriptor) 3 | } -------------------------------------------------------------------------------- /std/ops/add.hay: -------------------------------------------------------------------------------- 1 | interface Add { 2 | _: Output 3 | fn Op.add(A B) -> [Output] 4 | } -------------------------------------------------------------------------------- /std/ops/bit_and.hay: -------------------------------------------------------------------------------- 1 | interface BitAnd { 2 | _: Output 3 | fn Op.and(A B) -> [Output] 4 | } -------------------------------------------------------------------------------- /std/ops/bit_or.hay: -------------------------------------------------------------------------------- 1 | interface BitOr { 2 | _: Output 3 | fn Op.or(A B) -> [Output] 4 | } -------------------------------------------------------------------------------- /std/ops/bit_xor.hay: -------------------------------------------------------------------------------- 1 | interface BitXor { 2 | _: Output 3 | fn Op.xor(A B) -> [Output] 4 | } -------------------------------------------------------------------------------- /std/ops/div.hay: -------------------------------------------------------------------------------- 1 | interface Div { 2 | _: Output 3 | fn Op.div(A B) -> [Output] 4 | } -------------------------------------------------------------------------------- /std/ops/mul.hay: -------------------------------------------------------------------------------- 1 | interface Mul { 2 | _: Output 3 | fn Op.mul(A B) -> [Output] 4 | } -------------------------------------------------------------------------------- /std/ops/prelude.hay: -------------------------------------------------------------------------------- 1 | include "std/ops/add.hay" 2 | include "std/ops/div.hay" 3 | include "std/ops/mul.hay" 4 | include "std/ops/sub.hay" 5 | include "std/ops/bit_and.hay" 6 | include "std/ops/bit_or.hay" 7 | include "std/ops/bit_xor.hay" 8 | include "std/ops/shl.hay" 9 | include "std/ops/shr.hay" -------------------------------------------------------------------------------- /std/ops/shl.hay: -------------------------------------------------------------------------------- 1 | interface ShiftLeft { 2 | _: Output 3 | fn Op.shl(A B) -> [Output] 4 | } -------------------------------------------------------------------------------- /std/ops/shr.hay: -------------------------------------------------------------------------------- 1 | interface ShiftRight { 2 | _: Output 3 | fn Op.shr(A B) -> [Output] 4 | } -------------------------------------------------------------------------------- /std/ops/sub.hay: -------------------------------------------------------------------------------- 1 | interface Sub { 2 | _: Output 3 | fn Op.sub(A B) -> [Output] 4 | } -------------------------------------------------------------------------------- /std/sys/prelude.hay: -------------------------------------------------------------------------------- 1 | include "std/sys/x86_64.hay" 2 | 3 | fn exit(u64) -> [!] { sys_exit } --------------------------------------------------------------------------------