From 24e39d9bf9eb1992d5763fede2c8a5c5c5dcfddc Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Wed, 9 Feb 2022 13:28:51 +0100 Subject: [PATCH] bump: insta 1.12.0 --- crates/mun_codegen/Cargo.toml | 2 +- .../mun_codegen__test__arithmetic_op_f32.snap | 2 + .../mun_codegen__test__arithmetic_op_f64.snap | 2 + ...mun_codegen__test__arithmetic_op_i128.snap | 2 + .../mun_codegen__test__arithmetic_op_i16.snap | 2 + .../mun_codegen__test__arithmetic_op_i32.snap | 2 + .../mun_codegen__test__arithmetic_op_i64.snap | 2 + .../mun_codegen__test__arithmetic_op_i8.snap | 2 + ...mun_codegen__test__arithmetic_op_u128.snap | 2 + .../mun_codegen__test__arithmetic_op_u16.snap | 2 + .../mun_codegen__test__arithmetic_op_u32.snap | 2 + .../mun_codegen__test__arithmetic_op_u64.snap | 2 + .../mun_codegen__test__arithmetic_op_u8.snap | 2 + ...mun_codegen__test__assign_bit_op_bool.snap | 2 + ...mun_codegen__test__assign_bit_op_i128.snap | 2 + .../mun_codegen__test__assign_bit_op_i16.snap | 2 + .../mun_codegen__test__assign_bit_op_i32.snap | 2 + .../mun_codegen__test__assign_bit_op_i64.snap | 2 + .../mun_codegen__test__assign_bit_op_i8.snap | 2 + ...mun_codegen__test__assign_bit_op_u128.snap | 2 + .../mun_codegen__test__assign_bit_op_u16.snap | 2 + .../mun_codegen__test__assign_bit_op_u32.snap | 2 + .../mun_codegen__test__assign_bit_op_u64.snap | 2 + .../mun_codegen__test__assign_bit_op_u8.snap | 2 + ...n_codegen__test__assign_shift_op_i128.snap | 2 + ...un_codegen__test__assign_shift_op_i16.snap | 2 + ...un_codegen__test__assign_shift_op_i32.snap | 2 + ...un_codegen__test__assign_shift_op_i64.snap | 2 + ...mun_codegen__test__assign_shift_op_i8.snap | 2 + ...n_codegen__test__assign_shift_op_u128.snap | 2 + ...un_codegen__test__assign_shift_op_u16.snap | 2 + ...un_codegen__test__assign_shift_op_u32.snap | 2 + ...un_codegen__test__assign_shift_op_u64.snap | 2 + ...mun_codegen__test__assign_shift_op_u8.snap | 2 + ...mun_codegen__test__assignment_op_bool.snap | 2 + .../mun_codegen__test__assignment_op_f32.snap | 2 + .../mun_codegen__test__assignment_op_f64.snap | 2 + ...mun_codegen__test__assignment_op_i128.snap | 2 + .../mun_codegen__test__assignment_op_i16.snap | 2 + .../mun_codegen__test__assignment_op_i32.snap | 2 + .../mun_codegen__test__assignment_op_i64.snap | 2 + .../mun_codegen__test__assignment_op_i8.snap | 2 + ...n_codegen__test__assignment_op_struct.snap | 4 +- ...mun_codegen__test__assignment_op_u128.snap | 2 + .../mun_codegen__test__assignment_op_u16.snap | 2 + .../mun_codegen__test__assignment_op_u32.snap | 2 + .../mun_codegen__test__assignment_op_u64.snap | 2 + .../mun_codegen__test__assignment_op_u8.snap | 2 + .../mun_codegen__test__bit_op_bool.snap | 2 + .../mun_codegen__test__bit_op_i128.snap | 2 + .../mun_codegen__test__bit_op_i16.snap | 2 + .../mun_codegen__test__bit_op_i32.snap | 2 + .../mun_codegen__test__bit_op_i64.snap | 2 + .../mun_codegen__test__bit_op_i8.snap | 2 + .../mun_codegen__test__bit_op_u128.snap | 2 + .../mun_codegen__test__bit_op_u16.snap | 2 + .../mun_codegen__test__bit_op_u32.snap | 2 + .../mun_codegen__test__bit_op_u64.snap | 2 + .../mun_codegen__test__bit_op_u8.snap | 2 + .../mun_codegen__test__compare_op_bool.snap | 2 + .../mun_codegen__test__compare_op_f32.snap | 2 + .../mun_codegen__test__compare_op_f64.snap | 2 + .../mun_codegen__test__compare_op_i128.snap | 2 + .../mun_codegen__test__compare_op_i16.snap | 2 + .../mun_codegen__test__compare_op_i32.snap | 2 + .../mun_codegen__test__compare_op_i64.snap | 2 + .../mun_codegen__test__compare_op_i8.snap | 2 + .../mun_codegen__test__compare_op_u128.snap | 2 + .../mun_codegen__test__compare_op_u16.snap | 2 + .../mun_codegen__test__compare_op_u32.snap | 2 + .../mun_codegen__test__compare_op_u64.snap | 2 + .../mun_codegen__test__compare_op_u8.snap | 2 + ...odegen__test__conditional_return_expr.snap | 2 + .../mun_codegen__test__extern_fn.snap | 2 + .../mun_codegen__test__fibonacci.snap | 1 + .../mun_codegen__test__fibonacci_loop.snap | 2 + .../mun_codegen__test__field_crash.snap | 2 + .../mun_codegen__test__field_expr.snap | 3 +- .../mun_codegen__test__function.snap | 2 + ...mun_codegen__test__function_arguments.snap | 2 + .../mun_codegen__test__function_calls.snap | 1 + .../mun_codegen__test__gc_struct.snap | 2 + .../mun_codegen__test__if_statement.snap | 2 + ...mun_codegen__test__invalid_binary_ops.snap | 2 + .../mun_codegen__test__issue_128.snap | 2 + .../mun_codegen__test__issue_133.snap | 1 + .../mun_codegen__test__issue_225.snap | 2 + .../mun_codegen__test__issue_228.snap | 2 + ...mun_codegen__test__issue_228_never_if.snap | 2 + .../mun_codegen__test__issue_262.snap | 2 + .../mun_codegen__test__let_statement.snap | 2 + .../mun_codegen__test__literal_types.snap | 2 + .../mun_codegen__test__logic_op_bool.snap | 2 + .../mun_codegen__test__loop_break_expr.snap | 2 + .../mun_codegen__test__loop_expr.snap | 2 + .../mun_codegen__test__multi_file.snap | 1 + .../mun_codegen__test__negate_op_f32.snap | 2 + .../mun_codegen__test__negate_op_f64.snap | 2 + .../mun_codegen__test__negate_op_i128.snap | 2 + .../mun_codegen__test__negate_op_i16.snap | 2 + .../mun_codegen__test__negate_op_i32.snap | 2 + .../mun_codegen__test__negate_op_i64.snap | 2 + .../mun_codegen__test__negate_op_i8.snap | 2 + ...degen__test__nested_private_extern_fn.snap | 1 + .../mun_codegen__test__nested_private_fn.snap | 1 + ...en__test__nested_private_recursive_fn.snap | 1 + ...nested_private_recursive_fn_with_args.snap | 1 + .../mun_codegen__test__nested_structs.snap | 3 +- ...__test__never_conditional_return_expr.snap | 2 + .../mun_codegen__test__private_fn_only.snap | 2 + .../mun_codegen__test__return_expr.snap | 2 + .../mun_codegen__test__return_type.snap | 2 + .../mun_codegen__test__shadowing.snap | 2 + .../mun_codegen__test__shift_op_i128.snap | 2 + .../mun_codegen__test__shift_op_i16.snap | 2 + .../mun_codegen__test__shift_op_i32.snap | 2 + .../mun_codegen__test__shift_op_i64.snap | 2 + .../mun_codegen__test__shift_op_i8.snap | 2 + .../mun_codegen__test__shift_op_u128.snap | 2 + .../mun_codegen__test__shift_op_u16.snap | 2 + .../mun_codegen__test__shift_op_u32.snap | 2 + .../mun_codegen__test__shift_op_u64.snap | 2 + .../mun_codegen__test__shift_op_u8.snap | 2 + .../mun_codegen__test__struct_test.snap | 2 + .../mun_codegen__test__true_is_true.snap | 2 + .../mun_codegen__test__update_operators.snap | 2 + .../mun_codegen__test__update_parameter.snap | 2 + .../mun_codegen__test__void_return.snap | 1 + .../mun_codegen__test__while_expr.snap | 2 + crates/mun_compiler/Cargo.toml | 2 +- ...cs__tests__access_unknown_field_error.snap | 2 + ...stics__tests__cyclic_type_alias_error.snap | 2 + ...cs__tests__duplicate_definition_error.snap | 2 + ...diagnostics__tests__expected_function.snap | 2 + ...stics__tests__expected_function_error.snap | 2 + ...nostics__tests__free_type_alias_error.snap | 2 + ...s__leaked_private_type_error_function.snap | 1 + ...nostics__tests__mismatched_type_error.snap | 2 + ...possibly_uninitialized_variable_error.snap | 2 + ...ler__diagnostics__tests__syntax_error.snap | 2 + ...s__type_alias_target_undeclared_error.snap | 2 + ...nostics__tests__unresolved_type_error.snap | 2 + ...ostics__tests__unresolved_value_error.snap | 2 + crates/mun_hir/Cargo.toml | 2 +- ...or__tests__private_leak_struct_fields.snap | 8 - .../src/code_model/struct/validator/tests.rs | 17 +- ...sts__free_type_alias_without_type_ref.snap | 6 - ..._validator__tests__private_leak_alias.snap | 6 - ..._validator__tests__private_leak_basic.snap | 9 - ...or__tests__private_leak_function_args.snap | 8 - ...__tests__private_leak_function_return.snap | 8 - ...__tests__private_leak_function_scoped.snap | 7 - ...idator__tests__private_leak_functions.snap | 9 - ...alidator__tests__uninitialized_access.snap | 6 - ...dator__tests__uninitialized_access_if.snap | 6 - ...or__tests__uninitialized_access_while.snap | 6 - crates/mun_hir/src/expr/validator/tests.rs | 50 +- ...ir__item_tree__tests__top_level_items.snap | 2 + .../mun_hir__package_defs__tests__use_.snap | 15 - ...n_hir__package_defs__tests__use_alias.snap | 12 - ..._hir__package_defs__tests__use_cyclic.snap | 14 - ...kage_defs__tests__use_cyclic_wildcard.snap | 11 - ...ckage_defs__tests__use_duplicate_name.snap | 10 - ...un_hir__package_defs__tests__use_self.snap | 10 - ...__package_defs__tests__use_unresolved.snap | 10 - ...ir__package_defs__tests__use_wildcard.snap | 13 - crates/mun_hir/src/package_defs/tests.rs | 125 +- ...n_hir__module_tree__test__module_tree.snap | 2 + ...comparison_not_implemented_for_struct.snap | 9 - .../mun_hir__ty__tests__extern_fn.snap | 16 - .../mun_hir__ty__tests__infer_basics.snap | 13 - .../mun_hir__ty__tests__infer_branching.snap | 42 - .../mun_hir__ty__tests__infer_break.snap | 40 - ...__ty__tests__infer_conditional_return.snap | 27 - ..._ty__tests__infer_invalid_struct_type.snap | 9 - .../mun_hir__ty__tests__infer_literals.snap | 14 - .../mun_hir__ty__tests__infer_loop.snap | 7 - .../mun_hir__ty__tests__infer_return.snap | 9 - ...hir__ty__tests__infer_suffix_literals.snap | 48 - .../mun_hir__ty__tests__infer_type_alias.snap | 9 - .../mun_hir__ty__tests__infer_unary_ops.snap | 15 - .../mun_hir__ty__tests__infer_while.snap | 40 - ...un_hir__ty__tests__invalid_binary_ops.snap | 13 - ...mun_hir__ty__tests__invalid_unary_ops.snap | 17 - .../mun_hir__ty__tests__issue_354.snap | 17 - ...mun_hir__ty__tests__place_expressions.snap | 13 - .../mun_hir__ty__tests__primitives.snap | 27 - .../mun_hir__ty__tests__private_access.snap | 107 - .../mun_hir__ty__tests__recursive_alias.snap | 13 - .../mun_hir__ty__tests__scoped_path.snap | 19 - .../mun_hir__ty__tests__struct_decl.snap | 8 - ...un_hir__ty__tests__struct_field_index.snap | 38 - .../mun_hir__ty__tests__struct_lit.snap | 44 - .../mun_hir__ty__tests__update_operators.snap | 45 - .../mun_hir__ty__tests__void_return.snap | 12 - crates/mun_hir/src/ty/tests.rs | 756 ++++- crates/mun_hir/src/utils.rs | 8 +- crates/mun_language_server/Cargo.toml | 2 +- ...letion__dot__tests__incomplete_struct.snap | 2 + ...completion__dot__tests__nested_struct.snap | 2 + ...completion__dot__tests__struct_fields.snap | 2 + ..._completion__dot__tests__tuple_struct.snap | 2 + ..._unqualified_path__tests__local_scope.snap | 2 + .../initialization__document_symbols.snap | 2 + crates/mun_syntax/Cargo.toml | 2 +- crates/mun_syntax/src/tests/lexer.rs | 325 +- crates/mun_syntax/src/tests/parser.rs | 2861 ++++++++++++++++- .../mun_syntax__tests__lexer__binary_cmp.snap | 28 - .../mun_syntax__tests__lexer__comments.snap | 16 - .../mun_syntax__tests__lexer__ident.snap | 18 - .../mun_syntax__tests__lexer__keywords.snap | 50 - .../mun_syntax__tests__lexer__numbers.snap | 18 - .../mun_syntax__tests__lexer__strings.snap | 14 - .../mun_syntax__tests__lexer__symbols.snap | 121 - ...syntax__tests__lexer__unclosed_string.snap | 6 - .../mun_syntax__tests__lexer__whitespace.snap | 22 - ...x__tests__parser__arithmetic_operands.snap | 259 -- ...x__tests__parser__assignment_operands.snap | 205 -- ...un_syntax__tests__parser__binary_expr.snap | 63 - .../mun_syntax__tests__parser__block.snap | 55 - ...mun_syntax__tests__parser__block_expr.snap | 25 - ...mun_syntax__tests__parser__break_expr.snap | 62 - ...ntax__tests__parser__compare_operands.snap | 187 -- .../mun_syntax__tests__parser__empty.snap | 6 - ...__tests__parser__expression_statement.snap | 98 - .../mun_syntax__tests__parser__extern_fn.snap | 21 - .../mun_syntax__tests__parser__function.snap | 111 - ...syntax__tests__parser__function_calls.snap | 72 - ...__tests__parser__function_return_path.snap | 114 - .../mun_syntax__tests__parser__if_expr.snap | 103 - .../mun_syntax__tests__parser__literals.snap | 83 - ...syntax__tests__parser__logic_operands.snap | 67 - .../mun_syntax__tests__parser__loop_expr.snap | 26 - ..._tests__parser__memory_type_specifier.snap | 82 - ...ax__tests__parser__missing_field_expr.snap | 28 - .../mun_syntax__tests__parser__patterns.snap | 56 - ...un_syntax__tests__parser__return_expr.snap | 32 - ...mun_syntax__tests__parser__struct_def.snap | 218 -- ...ax__tests__parser__struct_field_index.snap | 115 - ...mun_syntax__tests__parser__struct_lit.snap | 152 - ...syntax__tests__parser__type_alias_def.snap | 35 - ...mun_syntax__tests__parser__unary_expr.snap | 53 - .../mun_syntax__tests__parser__use_.snap | 334 -- ...mun_syntax__tests__parser__visibility.snap | 94 - ...mun_syntax__tests__parser__while_expr.snap | 50 - crates/mun_target/Cargo.toml | 2 +- .../data_layout__data_layout_darwin.snap | 2 + .../data_layout__data_layout_linux.snap | 2 + .../data_layout__data_layout_windows.snap | 2 + 249 files changed, 4188 insertions(+), 4208 deletions(-) delete mode 100644 crates/mun_hir/src/code_model/struct/validator/snapshots/mun_hir__code_model__r#struct__validator__tests__private_leak_struct_fields.snap delete mode 100644 crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__free_type_alias_without_type_ref.snap delete mode 100644 crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_alias.snap delete mode 100644 crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_basic.snap delete mode 100644 crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_function_args.snap delete mode 100644 crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_function_return.snap delete mode 100644 crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_function_scoped.snap delete mode 100644 crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_functions.snap delete mode 100644 crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__uninitialized_access.snap delete mode 100644 crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__uninitialized_access_if.snap delete mode 100644 crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__uninitialized_access_while.snap delete mode 100644 crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_.snap delete mode 100644 crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_alias.snap delete mode 100644 crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_cyclic.snap delete mode 100644 crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_cyclic_wildcard.snap delete mode 100644 crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_duplicate_name.snap delete mode 100644 crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_self.snap delete mode 100644 crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_unresolved.snap delete mode 100644 crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_wildcard.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__comparison_not_implemented_for_struct.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__extern_fn.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_basics.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_branching.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_break.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_conditional_return.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_invalid_struct_type.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_literals.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_loop.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_return.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_suffix_literals.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_type_alias.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_unary_ops.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_while.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__invalid_binary_ops.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__invalid_unary_ops.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__issue_354.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__place_expressions.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__primitives.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__private_access.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__recursive_alias.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__scoped_path.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__struct_decl.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__struct_field_index.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__struct_lit.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__update_operators.snap delete mode 100644 crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__void_return.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__binary_cmp.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__comments.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__ident.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__keywords.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__numbers.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__strings.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__symbols.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__unclosed_string.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__whitespace.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__arithmetic_operands.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__assignment_operands.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__binary_expr.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__block.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__block_expr.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__break_expr.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__compare_operands.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__empty.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__expression_statement.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__extern_fn.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__function.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__function_calls.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__function_return_path.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__if_expr.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__literals.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__logic_operands.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__loop_expr.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__memory_type_specifier.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__missing_field_expr.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__patterns.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__return_expr.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__struct_def.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__struct_field_index.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__struct_lit.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__type_alias_def.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__unary_expr.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__use_.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__visibility.snap delete mode 100644 crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__while_expr.snap diff --git a/crates/mun_codegen/Cargo.toml b/crates/mun_codegen/Cargo.toml index 187811f19..97c36c62d 100644 --- a/crates/mun_codegen/Cargo.toml +++ b/crates/mun_codegen/Cargo.toml @@ -37,7 +37,7 @@ once_cell = "1.4.0" [dev-dependencies] abi = { path = "../mun_abi", package = "mun_abi" } -insta = "1.7.1" +insta = "1.12.0" libloader = { path = "../mun_libloader", package = "mun_libloader" } mun_test = { path = "../mun_test" } runtime = { path = "../mun_runtime", package = "mun_runtime" } diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_f32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_f32.snap index 8c90f823b..afed58fc1 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_f32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_f32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn add(a: f32, b: f32) -> f32 { a + b }\n pub fn subtract(a: f32, b: f32) -> f32 { a - b }\n pub fn multiply(a: f32, b: f32) -> f32 { a * b }\n pub fn divide(a: f32, b: f32) -> f32 { a / b }\n pub fn remainder(a: f32, b: f32) -> f32 { a % b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_f64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_f64.snap index 3f7d3feca..b85529b09 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_f64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_f64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn add(a: f64, b: f64) -> f64 { a + b }\n pub fn subtract(a: f64, b: f64) -> f64 { a - b }\n pub fn multiply(a: f64, b: f64) -> f64 { a * b }\n pub fn divide(a: f64, b: f64) -> f64 { a / b }\n pub fn remainder(a: f64, b: f64) -> f64 { a % b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i128.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i128.snap index 5a7cc45b5..6f79a393a 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i128.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i128.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn add(a: i128, b: i128) -> i128 { a + b }\n pub fn subtract(a: i128, b: i128) -> i128 { a - b }\n pub fn multiply(a: i128, b: i128) -> i128 { a * b }\n pub fn divide(a: i128, b: i128) -> i128 { a / b }\n pub fn remainder(a: i128, b: i128) -> i128 { a % b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i16.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i16.snap index d2c7342b6..0afe320f4 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i16.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i16.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn add(a: i16, b: i16) -> i16 { a + b }\n pub fn subtract(a: i16, b: i16) -> i16 { a - b }\n pub fn multiply(a: i16, b: i16) -> i16 { a * b }\n pub fn divide(a: i16, b: i16) -> i16 { a / b }\n pub fn remainder(a: i16, b: i16) -> i16 { a % b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i32.snap index 9b5d3fed4..7148722d0 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn add(a: i32, b: i32) -> i32 { a + b }\n pub fn subtract(a: i32, b: i32) -> i32 { a - b }\n pub fn multiply(a: i32, b: i32) -> i32 { a * b }\n pub fn divide(a: i32, b: i32) -> i32 { a / b }\n pub fn remainder(a: i32, b: i32) -> i32 { a % b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i64.snap index 70ce78009..2c9dd6cf0 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn add(a: i64, b: i64) -> i64 { a + b }\n pub fn subtract(a: i64, b: i64) -> i64 { a - b }\n pub fn multiply(a: i64, b: i64) -> i64 { a * b }\n pub fn divide(a: i64, b: i64) -> i64 { a / b }\n pub fn remainder(a: i64, b: i64) -> i64 { a % b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i8.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i8.snap index c06dd3f0c..e6aa14498 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i8.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_i8.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn add(a: i8, b: i8) -> i8 { a + b }\n pub fn subtract(a: i8, b: i8) -> i8 { a - b }\n pub fn multiply(a: i8, b: i8) -> i8 { a * b }\n pub fn divide(a: i8, b: i8) -> i8 { a / b }\n pub fn remainder(a: i8, b: i8) -> i8 { a % b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u128.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u128.snap index dbc51720f..edf0b7e36 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u128.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u128.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn add(a: u128, b: u128) -> u128 { a + b }\n pub fn subtract(a: u128, b: u128) -> u128 { a - b }\n pub fn multiply(a: u128, b: u128) -> u128 { a * b }\n pub fn divide(a: u128, b: u128) -> u128 { a / b }\n pub fn remainder(a: u128, b: u128) -> u128 { a % b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u16.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u16.snap index 9bf7372bc..f891f95ba 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u16.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u16.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn add(a: u16, b: u16) -> u16 { a + b }\n pub fn subtract(a: u16, b: u16) -> u16 { a - b }\n pub fn multiply(a: u16, b: u16) -> u16 { a * b }\n pub fn divide(a: u16, b: u16) -> u16 { a / b }\n pub fn remainder(a: u16, b: u16) -> u16 { a % b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u32.snap index 48abfe5bd..fe475347a 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn add(a: u32, b: u32) -> u32 { a + b }\n pub fn subtract(a: u32, b: u32) -> u32 { a - b }\n pub fn multiply(a: u32, b: u32) -> u32 { a * b }\n pub fn divide(a: u32, b: u32) -> u32 { a / b }\n pub fn remainder(a: u32, b: u32) -> u32 { a % b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u64.snap index 656a8fc02..229cce876 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn add(a: u64, b: u64) -> u64 { a + b }\n pub fn subtract(a: u64, b: u64) -> u64 { a - b }\n pub fn multiply(a: u64, b: u64) -> u64 { a * b }\n pub fn divide(a: u64, b: u64) -> u64 { a / b }\n pub fn remainder(a: u64, b: u64) -> u64 { a % b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u8.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u8.snap index feb4568a8..ca4b771ba 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u8.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__arithmetic_op_u8.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn add(a: u8, b: u8) -> u8 { a + b }\n pub fn subtract(a: u8, b: u8) -> u8 { a - b }\n pub fn multiply(a: u8, b: u8) -> u8 { a * b }\n pub fn divide(a: u8, b: u8) -> u8 { a / b }\n pub fn remainder(a: u8, b: u8) -> u8 { a % b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_bool.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_bool.snap index 66cdf8a2a..b6e03e451 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_bool.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_bool.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_bitand(a: bool, b: bool) -> bool {\n a &= b;\n a\n }\n pub fn assign_bitor(a: bool, b: bool) -> bool {\n a |= b;\n a\n }\n pub fn assign_bitxor(a: bool, b: bool) -> bool {\n a ^= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i128.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i128.snap index 8c134bd33..93cb68d56 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i128.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i128.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_bitand(a: i128, b: i128) -> i128 {\n a &= b;\n a\n }\n pub fn assign_bitor(a: i128, b: i128) -> i128 {\n a |= b;\n a\n }\n pub fn assign_bitxor(a: i128, b: i128) -> i128 {\n a ^= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i16.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i16.snap index dc074f773..269fa27d3 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i16.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i16.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_bitand(a: i16, b: i16) -> i16 {\n a &= b;\n a\n }\n pub fn assign_bitor(a: i16, b: i16) -> i16 {\n a |= b;\n a\n }\n pub fn assign_bitxor(a: i16, b: i16) -> i16 {\n a ^= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i32.snap index 5b7012ee6..b40d8824c 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_bitand(a: i32, b: i32) -> i32 {\n a &= b;\n a\n }\n pub fn assign_bitor(a: i32, b: i32) -> i32 {\n a |= b;\n a\n }\n pub fn assign_bitxor(a: i32, b: i32) -> i32 {\n a ^= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i64.snap index 6a3a3b2f8..d8287cdfe 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_bitand(a: i64, b: i64) -> i64 {\n a &= b;\n a\n }\n pub fn assign_bitor(a: i64, b: i64) -> i64 {\n a |= b;\n a\n }\n pub fn assign_bitxor(a: i64, b: i64) -> i64 {\n a ^= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i8.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i8.snap index 8fda48c76..2348680c4 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i8.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_i8.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_bitand(a: i8, b: i8) -> i8 {\n a &= b;\n a\n }\n pub fn assign_bitor(a: i8, b: i8) -> i8 {\n a |= b;\n a\n }\n pub fn assign_bitxor(a: i8, b: i8) -> i8 {\n a ^= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u128.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u128.snap index e7ac8f73c..234766a83 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u128.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u128.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_bitand(a: u128, b: u128) -> u128 {\n a &= b;\n a\n }\n pub fn assign_bitor(a: u128, b: u128) -> u128 {\n a |= b;\n a\n }\n pub fn assign_bitxor(a: u128, b: u128) -> u128 {\n a ^= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u16.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u16.snap index d342d4c96..2a346c86d 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u16.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u16.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_bitand(a: u16, b: u16) -> u16 {\n a &= b;\n a\n }\n pub fn assign_bitor(a: u16, b: u16) -> u16 {\n a |= b;\n a\n }\n pub fn assign_bitxor(a: u16, b: u16) -> u16 {\n a ^= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u32.snap index ef59eaa69..6ffb7afaf 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_bitand(a: u32, b: u32) -> u32 {\n a &= b;\n a\n }\n pub fn assign_bitor(a: u32, b: u32) -> u32 {\n a |= b;\n a\n }\n pub fn assign_bitxor(a: u32, b: u32) -> u32 {\n a ^= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u64.snap index b768f2a10..c4ff0f514 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_bitand(a: u64, b: u64) -> u64 {\n a &= b;\n a\n }\n pub fn assign_bitor(a: u64, b: u64) -> u64 {\n a |= b;\n a\n }\n pub fn assign_bitxor(a: u64, b: u64) -> u64 {\n a ^= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u8.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u8.snap index 6b93fbfea..3ca04bb21 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u8.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_bit_op_u8.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_bitand(a: u8, b: u8) -> u8 {\n a &= b;\n a\n }\n pub fn assign_bitor(a: u8, b: u8) -> u8 {\n a |= b;\n a\n }\n pub fn assign_bitxor(a: u8, b: u8) -> u8 {\n a ^= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i128.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i128.snap index 34afb9b15..3f77800bf 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i128.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i128.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_leftshift(a: i128, b: i128) -> i128 {\n a <<= b;\n a\n }\n pub fn assign_rightshift(a: i128, b: i128) -> i128 {\n a >>= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i16.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i16.snap index 778c7275f..9c7bc08a7 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i16.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i16.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_leftshift(a: i16, b: i16) -> i16 {\n a <<= b;\n a\n }\n pub fn assign_rightshift(a: i16, b: i16) -> i16 {\n a >>= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i32.snap index 155e30366..b786e8c37 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_leftshift(a: i32, b: i32) -> i32 {\n a <<= b;\n a\n }\n pub fn assign_rightshift(a: i32, b: i32) -> i32 {\n a >>= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i64.snap index eb5cf4cc8..2290cd2a8 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_leftshift(a: i64, b: i64) -> i64 {\n a <<= b;\n a\n }\n pub fn assign_rightshift(a: i64, b: i64) -> i64 {\n a >>= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i8.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i8.snap index 3487f9106..ede1ce84e 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i8.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_i8.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_leftshift(a: i8, b: i8) -> i8 {\n a <<= b;\n a\n }\n pub fn assign_rightshift(a: i8, b: i8) -> i8 {\n a >>= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u128.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u128.snap index f0e690a50..235b431c9 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u128.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u128.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_leftshift(a: u128, b: u128) -> u128 {\n a <<= b;\n a\n }\n pub fn assign_rightshift(a: u128, b: u128) -> u128 {\n a >>= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u16.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u16.snap index 455d45840..3129033dd 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u16.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u16.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_leftshift(a: u16, b: u16) -> u16 {\n a <<= b;\n a\n }\n pub fn assign_rightshift(a: u16, b: u16) -> u16 {\n a >>= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u32.snap index aa74b1734..b74e6ac67 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_leftshift(a: u32, b: u32) -> u32 {\n a <<= b;\n a\n }\n pub fn assign_rightshift(a: u32, b: u32) -> u32 {\n a >>= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u64.snap index 23b8563f4..78bd7a665 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_leftshift(a: u64, b: u64) -> u64 {\n a <<= b;\n a\n }\n pub fn assign_rightshift(a: u64, b: u64) -> u64 {\n a >>= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u8.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u8.snap index 78364efa7..b4ed5bd82 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u8.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assign_shift_op_u8.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign_leftshift(a: u8, b: u8) -> u8 {\n a <<= b;\n a\n }\n pub fn assign_rightshift(a: u8, b: u8) -> u8 {\n a >>= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_bool.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_bool.snap index 134a28bfe..a536484ef 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_bool.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_bool.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign(a: bool, b: bool) -> bool {\n a = b;\n a\n }\n // TODO: Add errors\n // a += b;\n // a *= b;\n // a -= b;\n // a /= b;\n // a %= b;\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_f32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_f32.snap index 4af2692bd..0ecc9b4a2 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_f32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_f32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign(a: f32, b: f32) -> f32 {\n a = b;\n a\n }\n pub fn assign_add(a: f32, b: f32) -> f32 {\n a += b;\n a\n }\n pub fn assign_subtract(a: f32, b: f32) -> f32 {\n a -= b;\n a\n }\n pub fn assign_multiply(a: f32, b: f32) -> f32 {\n a *= b;\n a\n }\n pub fn assign_divide(a: f32, b: f32) -> f32 {\n a /= b;\n a\n }\n pub fn assign_remainder(a: f32, b: f32) -> f32 {\n a %= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_f64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_f64.snap index c9a6e5b2e..4e048ad76 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_f64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_f64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign(a: f64, b: f64) -> f64 {\n a = b;\n a\n }\n pub fn assign_add(a: f64, b: f64) -> f64 {\n a += b;\n a\n }\n pub fn assign_subtract(a: f64, b: f64) -> f64 {\n a -= b;\n a\n }\n pub fn assign_multiply(a: f64, b: f64) -> f64 {\n a *= b;\n a\n }\n pub fn assign_divide(a: f64, b: f64) -> f64 {\n a /= b;\n a\n }\n pub fn assign_remainder(a: f64, b: f64) -> f64 {\n a %= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i128.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i128.snap index 05d8133e3..8fc4cbf6a 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i128.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i128.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign(a: i128, b: i128) -> i128 {\n a = b;\n a\n }\n pub fn assign_add(a: i128, b: i128) -> i128 {\n a += b;\n a\n }\n pub fn assign_subtract(a: i128, b: i128) -> i128 {\n a -= b;\n a\n }\n pub fn assign_multiply(a: i128, b: i128) -> i128 {\n a *= b;\n a\n }\n pub fn assign_divide(a: i128, b: i128) -> i128 {\n a /= b;\n a\n }\n pub fn assign_remainder(a: i128, b: i128) -> i128 {\n a %= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i16.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i16.snap index f20dcd391..610d0714b 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i16.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i16.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign(a: i16, b: i16) -> i16 {\n a = b;\n a\n }\n pub fn assign_add(a: i16, b: i16) -> i16 {\n a += b;\n a\n }\n pub fn assign_subtract(a: i16, b: i16) -> i16 {\n a -= b;\n a\n }\n pub fn assign_multiply(a: i16, b: i16) -> i16 {\n a *= b;\n a\n }\n pub fn assign_divide(a: i16, b: i16) -> i16 {\n a /= b;\n a\n }\n pub fn assign_remainder(a: i16, b: i16) -> i16 {\n a %= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i32.snap index a3f14625b..2914f4b72 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign(a: i32, b: i32) -> i32 {\n a = b;\n a\n }\n pub fn assign_add(a: i32, b: i32) -> i32 {\n a += b;\n a\n }\n pub fn assign_subtract(a: i32, b: i32) -> i32 {\n a -= b;\n a\n }\n pub fn assign_multiply(a: i32, b: i32) -> i32 {\n a *= b;\n a\n }\n pub fn assign_divide(a: i32, b: i32) -> i32 {\n a /= b;\n a\n }\n pub fn assign_remainder(a: i32, b: i32) -> i32 {\n a %= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i64.snap index a08728fdf..b2678a43a 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign(a: i64, b: i64) -> i64 {\n a = b;\n a\n }\n pub fn assign_add(a: i64, b: i64) -> i64 {\n a += b;\n a\n }\n pub fn assign_subtract(a: i64, b: i64) -> i64 {\n a -= b;\n a\n }\n pub fn assign_multiply(a: i64, b: i64) -> i64 {\n a *= b;\n a\n }\n pub fn assign_divide(a: i64, b: i64) -> i64 {\n a /= b;\n a\n }\n pub fn assign_remainder(a: i64, b: i64) -> i64 {\n a %= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i8.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i8.snap index 6e0d77789..c82d030e7 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i8.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_i8.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign(a: i8, b: i8) -> i8 {\n a = b;\n a\n }\n pub fn assign_add(a: i8, b: i8) -> i8 {\n a += b;\n a\n }\n pub fn assign_subtract(a: i8, b: i8) -> i8 {\n a -= b;\n a\n }\n pub fn assign_multiply(a: i8, b: i8) -> i8 {\n a *= b;\n a\n }\n pub fn assign_divide(a: i8, b: i8) -> i8 {\n a /= b;\n a\n }\n pub fn assign_remainder(a: i8, b: i8) -> i8 {\n a %= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_struct.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_struct.snap index 20ede238c..3e7143aa9 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_struct.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_struct.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs -expression: "\n struct(value) Value(i32, i32);\n struct(gc) Heap(f64, f64);\n\n pub fn assign_value(a: Value, b: Value) -> Value {\n a = b;\n a\n }\n\n pub fn assign_heap(a: Heap, b: Heap) -> Heap {\n a = b;\n a\n }\n // TODO: Add errors\n // a += b;\n // a *= b;\n // a -= b;\n // a /= b;\n // a %= b;\n " +assertion_line: 1045 +expression: "\n pub struct(value) Value(i32, i32);\n pub struct(gc) Heap(f64, f64);\n\n pub fn assign_value(a: Value, b: Value) -> Value {\n a = b;\n a\n }\n\n pub fn assign_heap(a: Heap, b: Heap) -> Heap {\n a = b;\n a\n }\n // TODO: Add errors\n // a += b;\n // a *= b;\n // a -= b;\n // a /= b;\n // a %= b;\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u128.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u128.snap index 5852c7862..3c47b26cf 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u128.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u128.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign(a: u128, b: u128) -> u128 {\n a = b;\n a\n }\n pub fn assign_add(a: u128, b: u128) -> u128 {\n a += b;\n a\n }\n pub fn assign_subtract(a: u128, b: u128) -> u128 {\n a -= b;\n a\n }\n pub fn assign_multiply(a: u128, b: u128) -> u128 {\n a *= b;\n a\n }\n pub fn assign_divide(a: u128, b: u128) -> u128 {\n a /= b;\n a\n }\n pub fn assign_remainder(a: u128, b: u128) -> u128 {\n a %= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u16.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u16.snap index 4779537a7..162276751 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u16.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u16.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign(a: u16, b: u16) -> u16 {\n a = b;\n a\n }\n pub fn assign_add(a: u16, b: u16) -> u16 {\n a += b;\n a\n }\n pub fn assign_subtract(a: u16, b: u16) -> u16 {\n a -= b;\n a\n }\n pub fn assign_multiply(a: u16, b: u16) -> u16 {\n a *= b;\n a\n }\n pub fn assign_divide(a: u16, b: u16) -> u16 {\n a /= b;\n a\n }\n pub fn assign_remainder(a: u16, b: u16) -> u16 {\n a %= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u32.snap index 58088f9af..d5d190bf1 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign(a: u32, b: u32) -> u32 {\n a = b;\n a\n }\n pub fn assign_add(a: u32, b: u32) -> u32 {\n a += b;\n a\n }\n pub fn assign_subtract(a: u32, b: u32) -> u32 {\n a -= b;\n a\n }\n pub fn assign_multiply(a: u32, b: u32) -> u32 {\n a *= b;\n a\n }\n pub fn assign_divide(a: u32, b: u32) -> u32 {\n a /= b;\n a\n }\n pub fn assign_remainder(a: u32, b: u32) -> u32 {\n a %= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u64.snap index f640e97b9..c2b95a918 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign(a: u64, b: u64) -> u64 {\n a = b;\n a\n }\n pub fn assign_add(a: u64, b: u64) -> u64 {\n a += b;\n a\n }\n pub fn assign_subtract(a: u64, b: u64) -> u64 {\n a -= b;\n a\n }\n pub fn assign_multiply(a: u64, b: u64) -> u64 {\n a *= b;\n a\n }\n pub fn assign_divide(a: u64, b: u64) -> u64 {\n a /= b;\n a\n }\n pub fn assign_remainder(a: u64, b: u64) -> u64 {\n a %= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u8.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u8.snap index a750559a0..ae6366ecf 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u8.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__assignment_op_u8.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn assign(a: u8, b: u8) -> u8 {\n a = b;\n a\n }\n pub fn assign_add(a: u8, b: u8) -> u8 {\n a += b;\n a\n }\n pub fn assign_subtract(a: u8, b: u8) -> u8 {\n a -= b;\n a\n }\n pub fn assign_multiply(a: u8, b: u8) -> u8 {\n a *= b;\n a\n }\n pub fn assign_divide(a: u8, b: u8) -> u8 {\n a /= b;\n a\n }\n pub fn assign_remainder(a: u8, b: u8) -> u8 {\n a %= b;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_bool.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_bool.snap index 1d0506bca..ada3dcf66 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_bool.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_bool.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn not(a: bool) -> bool { !a }\n pub fn bitand(a: bool, b: bool) -> bool { a & b }\n pub fn bitor(a: bool, b: bool) -> bool { a | b }\n pub fn bitxor(a: bool, b: bool) -> bool { a ^ b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i128.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i128.snap index 8ae24c7a1..64088a422 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i128.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i128.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn not(a: i128) -> i128 { !a }\n pub fn bitand(a: i128, b: i128) -> i128 { a & b }\n pub fn bitor(a: i128, b: i128) -> i128 { a | b }\n pub fn bitxor(a: i128, b: i128) -> i128 { a ^ b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i16.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i16.snap index bc42c7422..3c6b04722 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i16.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i16.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn not(a: i16) -> i16 { !a }\n pub fn bitand(a: i16, b: i16) -> i16 { a & b }\n pub fn bitor(a: i16, b: i16) -> i16 { a | b }\n pub fn bitxor(a: i16, b: i16) -> i16 { a ^ b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i32.snap index 054520638..4fe1654b1 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn not(a: i32) -> i32 { !a }\n pub fn bitand(a: i32, b: i32) -> i32 { a & b }\n pub fn bitor(a: i32, b: i32) -> i32 { a | b }\n pub fn bitxor(a: i32, b: i32) -> i32 { a ^ b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i64.snap index 4acd21ea4..a287c01fa 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn not(a: i64) -> i64 { !a }\n pub fn bitand(a: i64, b: i64) -> i64 { a & b }\n pub fn bitor(a: i64, b: i64) -> i64 { a | b }\n pub fn bitxor(a: i64, b: i64) -> i64 { a ^ b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i8.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i8.snap index c4b9028e3..655f71d9e 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i8.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_i8.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn not(a: i8) -> i8 { !a }\n pub fn bitand(a: i8, b: i8) -> i8 { a & b }\n pub fn bitor(a: i8, b: i8) -> i8 { a | b }\n pub fn bitxor(a: i8, b: i8) -> i8 { a ^ b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u128.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u128.snap index 6a538e4bf..4ed9c7cec 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u128.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u128.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn not(a: u128) -> u128 { !a }\n pub fn bitand(a: u128, b: u128) -> u128 { a & b }\n pub fn bitor(a: u128, b: u128) -> u128 { a | b }\n pub fn bitxor(a: u128, b: u128) -> u128 { a ^ b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u16.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u16.snap index e67f87e2f..ffa694dc1 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u16.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u16.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn not(a: u16) -> u16 { !a }\n pub fn bitand(a: u16, b: u16) -> u16 { a & b }\n pub fn bitor(a: u16, b: u16) -> u16 { a | b }\n pub fn bitxor(a: u16, b: u16) -> u16 { a ^ b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u32.snap index 8959581ad..f425be5d4 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn not(a: u32) -> u32 { !a }\n pub fn bitand(a: u32, b: u32) -> u32 { a & b }\n pub fn bitor(a: u32, b: u32) -> u32 { a | b }\n pub fn bitxor(a: u32, b: u32) -> u32 { a ^ b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u64.snap index 1fc3b7a7b..624b89edf 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn not(a: u64) -> u64 { !a }\n pub fn bitand(a: u64, b: u64) -> u64 { a & b }\n pub fn bitor(a: u64, b: u64) -> u64 { a | b }\n pub fn bitxor(a: u64, b: u64) -> u64 { a ^ b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u8.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u8.snap index 82addc6ed..071c0308f 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u8.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__bit_op_u8.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn not(a: u8) -> u8 { !a }\n pub fn bitand(a: u8, b: u8) -> u8 { a & b }\n pub fn bitor(a: u8, b: u8) -> u8 { a | b }\n pub fn bitxor(a: u8, b: u8) -> u8 { a ^ b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_bool.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_bool.snap index 025c79ce5..6a61c2094 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_bool.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_bool.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn equals(a: bool, b: bool) -> bool { a == b }\n pub fn not_equal(a: bool, b: bool) -> bool { a != b}\n pub fn less(a: bool, b: bool) -> bool { a < b }\n pub fn less_equal(a: bool, b: bool) -> bool { a <= b }\n pub fn greater(a: bool, b: bool) -> bool { a > b }\n pub fn greater_equal(a: bool, b: bool) -> bool { a >= b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_f32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_f32.snap index f9154fe9f..8473fa42b 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_f32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_f32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn equals(a: f32, b: f32) -> bool { a == b }\n pub fn not_equal(a: f32, b: f32) -> bool { a != b}\n pub fn less(a: f32, b: f32) -> bool { a < b }\n pub fn less_equal(a: f32, b: f32) -> bool { a <= b }\n pub fn greater(a: f32, b: f32) -> bool { a > b }\n pub fn greater_equal(a: f32, b: f32) -> bool { a >= b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_f64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_f64.snap index 6dfe986f6..dd460bd20 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_f64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_f64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn equals(a: f64, b: f64) -> bool { a == b }\n pub fn not_equal(a: f64, b: f64) -> bool { a != b}\n pub fn less(a: f64, b: f64) -> bool { a < b }\n pub fn less_equal(a: f64, b: f64) -> bool { a <= b }\n pub fn greater(a: f64, b: f64) -> bool { a > b }\n pub fn greater_equal(a: f64, b: f64) -> bool { a >= b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i128.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i128.snap index 95efe54ee..4e9d7dd1f 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i128.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i128.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn equals(a: i128, b: i128) -> bool { a == b }\n pub fn not_equal(a: i128, b: i128) -> bool { a != b}\n pub fn less(a: i128, b: i128) -> bool { a < b }\n pub fn less_equal(a: i128, b: i128) -> bool { a <= b }\n pub fn greater(a: i128, b: i128) -> bool { a > b }\n pub fn greater_equal(a: i128, b: i128) -> bool { a >= b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i16.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i16.snap index 6cef06814..22939a104 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i16.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i16.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn equals(a: i16, b: i16) -> bool { a == b }\n pub fn not_equal(a: i16, b: i16) -> bool { a != b}\n pub fn less(a: i16, b: i16) -> bool { a < b }\n pub fn less_equal(a: i16, b: i16) -> bool { a <= b }\n pub fn greater(a: i16, b: i16) -> bool { a > b }\n pub fn greater_equal(a: i16, b: i16) -> bool { a >= b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i32.snap index 3e083e23b..82c61d69f 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn equals(a: i32, b: i32) -> bool { a == b }\n pub fn not_equal(a: i32, b: i32) -> bool { a != b}\n pub fn less(a: i32, b: i32) -> bool { a < b }\n pub fn less_equal(a: i32, b: i32) -> bool { a <= b }\n pub fn greater(a: i32, b: i32) -> bool { a > b }\n pub fn greater_equal(a: i32, b: i32) -> bool { a >= b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i64.snap index 66c206165..e531dc156 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn equals(a: i64, b: i64) -> bool { a == b }\n pub fn not_equal(a: i64, b: i64) -> bool { a != b}\n pub fn less(a: i64, b: i64) -> bool { a < b }\n pub fn less_equal(a: i64, b: i64) -> bool { a <= b }\n pub fn greater(a: i64, b: i64) -> bool { a > b }\n pub fn greater_equal(a: i64, b: i64) -> bool { a >= b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i8.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i8.snap index d86c7756f..112cd385a 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i8.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_i8.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn equals(a: i8, b: i8) -> bool { a == b }\n pub fn not_equal(a: i8, b: i8) -> bool { a != b}\n pub fn less(a: i8, b: i8) -> bool { a < b }\n pub fn less_equal(a: i8, b: i8) -> bool { a <= b }\n pub fn greater(a: i8, b: i8) -> bool { a > b }\n pub fn greater_equal(a: i8, b: i8) -> bool { a >= b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u128.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u128.snap index 385c1fbf5..6fd77d1bb 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u128.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u128.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn equals(a: u128, b: u128) -> bool { a == b }\n pub fn not_equal(a: u128, b: u128) -> bool { a != b}\n pub fn less(a: u128, b: u128) -> bool { a < b }\n pub fn less_equal(a: u128, b: u128) -> bool { a <= b }\n pub fn greater(a: u128, b: u128) -> bool { a > b }\n pub fn greater_equal(a: u128, b: u128) -> bool { a >= b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u16.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u16.snap index 0ce20c8f5..161e09819 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u16.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u16.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn equals(a: u16, b: u16) -> bool { a == b }\n pub fn not_equal(a: u16, b: u16) -> bool { a != b}\n pub fn less(a: u16, b: u16) -> bool { a < b }\n pub fn less_equal(a: u16, b: u16) -> bool { a <= b }\n pub fn greater(a: u16, b: u16) -> bool { a > b }\n pub fn greater_equal(a: u16, b: u16) -> bool { a >= b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u32.snap index 383e3615c..fff4791bc 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn equals(a: u32, b: u32) -> bool { a == b }\n pub fn not_equal(a: u32, b: u32) -> bool { a != b}\n pub fn less(a: u32, b: u32) -> bool { a < b }\n pub fn less_equal(a: u32, b: u32) -> bool { a <= b }\n pub fn greater(a: u32, b: u32) -> bool { a > b }\n pub fn greater_equal(a: u32, b: u32) -> bool { a >= b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u64.snap index be749b742..0654fab92 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn equals(a: u64, b: u64) -> bool { a == b }\n pub fn not_equal(a: u64, b: u64) -> bool { a != b}\n pub fn less(a: u64, b: u64) -> bool { a < b }\n pub fn less_equal(a: u64, b: u64) -> bool { a <= b }\n pub fn greater(a: u64, b: u64) -> bool { a > b }\n pub fn greater_equal(a: u64, b: u64) -> bool { a >= b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u8.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u8.snap index d049d20c4..d53df092c 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u8.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__compare_op_u8.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn equals(a: u8, b: u8) -> bool { a == b }\n pub fn not_equal(a: u8, b: u8) -> bool { a != b}\n pub fn less(a: u8, b: u8) -> bool { a < b }\n pub fn less_equal(a: u8, b: u8) -> bool { a <= b }\n pub fn greater(a: u8, b: u8) -> bool { a > b }\n pub fn greater_equal(a: u8, b: u8) -> bool { a >= b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__conditional_return_expr.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__conditional_return_expr.snap index 23dc8da8b..4d6d1be2f 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__conditional_return_expr.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__conditional_return_expr.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn main(a:i32) -> i32 {\n if a > 4 {\n return a;\n }\n a - 1\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__extern_fn.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__extern_fn.snap index 3aba53f09..dcdde0f45 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__extern_fn.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__extern_fn.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n extern fn add(a:i32, b:i32) -> i32;\n pub fn main() {\n add(3,4);\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__fibonacci.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__fibonacci.snap index b73d578df..f150cfe97 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__fibonacci.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__fibonacci.snap @@ -1,5 +1,6 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn fibonacci(n:i32) -> i32 {\n if n <= 1 {\n n\n } else {\n fibonacci(n-1) + fibonacci(n-2)\n }\n }\n " --- diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__fibonacci_loop.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__fibonacci_loop.snap index 1f3efb842..10b82f06d 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__fibonacci_loop.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__fibonacci_loop.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn fibonacci(n:i32) -> i32 {\n let a = 0;\n let b = 1;\n let i = 1;\n loop {\n if i > n {\n return a\n }\n let sum = a + b;\n a = b;\n b = sum;\n i += 1;\n }\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__field_crash.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__field_crash.snap index 7b4236d71..cfa1dde6f 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__field_crash.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__field_crash.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n struct(gc) Foo { a: i32 };\n\n pub fn main(c:i32) -> i32 {\n let b = Foo { a: c + 5 }\n b.a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__field_expr.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__field_expr.snap index 21a9328fe..bdda85bef 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__field_expr.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__field_expr.snap @@ -1,6 +1,7 @@ --- source: crates/mun_codegen/src/test.rs -expression: "\n struct(value) Bar(f64, Foo);\n struct(value) Foo { a: i32 };\n\n fn bar_1(bar: Bar) -> Foo {\n bar.1\n }\n\n fn foo_a(foo: Foo) -> i32 {\n foo.a\n }\n\n pub fn bar_1_foo_a(bar: Bar) -> i32 {\n foo_a(bar_1(bar))\n }\n\n pub fn main() -> i32 {\n let a: Foo = Foo { a: 5 };\n let b: Bar = Bar(1.23, a);\n let aa_lhs = a.a + 2;\n let aa_rhs = 2 + a.a;\n aa_lhs + aa_rhs\n }\n " +assertion_line: 1045 +expression: "\n pub struct(value) Bar(f64, Foo);\n pub struct(value) Foo { a: i32 };\n\n fn bar_1(bar: Bar) -> Foo {\n bar.1\n }\n\n fn foo_a(foo: Foo) -> i32 {\n foo.a\n }\n\n pub fn bar_1_foo_a(bar: Bar) -> i32 {\n foo_a(bar_1(bar))\n }\n\n pub fn main() -> i32 {\n let a: Foo = Foo { a: 5 };\n let b: Bar = Bar(1.23, a);\n let aa_lhs = a.a + 2;\n let aa_rhs = 2 + a.a;\n aa_lhs + aa_rhs\n }\n " --- ; == FILE IR (mod) ===================================== diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__function.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__function.snap index 6363f7bc7..ab5c94601 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__function.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__function.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn main() {\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__function_arguments.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__function_arguments.snap index 9aa50493e..87d237dae 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__function_arguments.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__function_arguments.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn main(a:i32) -> i32 {\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__function_calls.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__function_calls.snap index e608fd01d..0cd026e23 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__function_calls.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__function_calls.snap @@ -1,5 +1,6 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n fn add_impl(a:i32, b:i32) -> i32 {\n a+b\n }\n\n fn add(a:i32, b:i32) -> i32 {\n add_impl(a,b)\n }\n\n pub fn test() -> i32 {\n add(4,5)\n add_impl(4,5)\n add(4,5)\n }\n " --- diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__gc_struct.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__gc_struct.snap index f66e6336a..63c0ff38a 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__gc_struct.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__gc_struct.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n struct(gc) Foo { a: i32, b: i32 };\n\n pub fn foo() {\n let a = Foo { a: 3, b: 4 };\n a.b += 3;\n let b = a;\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__if_statement.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__if_statement.snap index 4336f88db..8d5ab49e4 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__if_statement.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__if_statement.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn foo(a:i32) -> i32 {\n let b = if a > 3 {\n let c = if a > 4 {\n a+1\n } else {\n a+3\n }\n c\n } else {\n a-1\n }\n b\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__invalid_binary_ops.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__invalid_binary_ops.snap index 6e76b220c..3c298b493 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__invalid_binary_ops.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__invalid_binary_ops.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn main() {\n let a = 3+3.0;\n let b = 3.0+3;\n }\n " + --- mod.mun (2:13): error: mismatched type mod.mun (3:15): error: mismatched type diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_128.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_128.snap index 439444961..dba8d0a05 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_128.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_128.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n // resources/script.mun\n extern fn thing(n: i32);\n extern fn print(n: i32) -> i32;\n\n pub fn main() {\n // 1st\n print(1);\n thing(5);\n\n // 2nd\n print(2);\n thing(78);\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_133.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_133.snap index c7b0e7ede..996d233c0 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_133.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_133.snap @@ -1,5 +1,6 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n fn do_the_things(n: i32) -> i32 {\n n + 7\n }\n \n pub fn main() {\n do_the_things(3);\n }\n " --- diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_225.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_225.snap index b1f74ec38..eedec7abf 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_225.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_225.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n struct Num {\n value: i64,\n }\n\n pub fn foo(b: i64) {\n Num { value: b }.value;\n }\n\n pub fn bar(b: i64) {\n { let a = Num { value: b }; a}.value;\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_228.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_228.snap index c3063fb9b..00ff6974a 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_228.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_228.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn fact(n: usize) -> usize {\n \t if n == 0 {return 1} else {n * (n-1)}\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_228_never_if.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_228_never_if.snap index 3f8e44647..ad2ff3b99 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_228_never_if.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_228_never_if.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn fact(n: usize) -> usize {\n \t if n == 0 {return 1} else {return n * (n-1)}\n \t return 2;\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_262.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_262.snap index 91042e885..2b9a94fba 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_262.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__issue_262.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n fn foo() -> i32 {\n let bar = {\n let b = 3;\n return b + 3;\n };\n\n // This code will never be executed\n let a = 3 + 4;\n a\n }" + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__let_statement.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__let_statement.snap index 6a5e4ed2a..4ca79e67c 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__let_statement.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__let_statement.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn main(a:i32) -> i32 {\n let b = a+1\n b\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__literal_types.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__literal_types.snap index 19bd70b1d..1b2b06bce 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__literal_types.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__literal_types.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn main(){\n let a = 123;\n let a = 123u8;\n let a = 123u16;\n let a = 123u32;\n let a = 123u64;\n let a = 123u128;\n let a = 1_000_000_u32;\n let a = 123i8;\n let a = 123i16;\n let a = 123i32;\n let a = 123i64;\n let a = 123123123123123123123123123123123i128;\n let a = 1_000_000_i32;\n let a = 1_000_123.0e-2;\n let a = 1_000_123.0e-2f32;\n let a = 1_000_123.0e-2f64;\n }\n\n pub fn add(a:u32) -> u32 {\n a + 12u32\n }" + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__logic_op_bool.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__logic_op_bool.snap index cb15f266a..680daba12 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__logic_op_bool.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__logic_op_bool.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn and(a: bool, b: bool) -> bool {\n a && b\n }\n pub fn or(a: bool, b: bool) -> bool {\n a || b\n } \n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__loop_break_expr.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__loop_break_expr.snap index dc7194a27..c2ba0e1ae 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__loop_break_expr.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__loop_break_expr.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn foo(n:i32) -> i32 {\n loop {\n if n > 5 {\n break n;\n }\n if n > 10 {\n break 10;\n }\n n += 1;\n }\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__loop_expr.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__loop_expr.snap index 3421af22f..ac9a209c6 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__loop_expr.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__loop_expr.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn foo() {\n loop {}\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__multi_file.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__multi_file.snap index c2cb6e3c6..572be7210 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__multi_file.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__multi_file.snap @@ -1,5 +1,6 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n //- /mod.mun\n pub fn main() -> i32 {\n foo::get_value()\n }\n\n //- /foo.mun\n pub(super) fn get_value() -> i32 {\n 3\n }\n " --- diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_f32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_f32.snap index a284fcd91..42fd0d40c 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_f32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_f32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn negate(a: f32) -> f32 { -a }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_f64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_f64.snap index 53d329e27..ca40b7beb 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_f64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_f64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn negate(a: f64) -> f64 { -a }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i128.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i128.snap index 72380a525..c70c3bbe2 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i128.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i128.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn negate(a: i128) -> i128 { -a }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i16.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i16.snap index 43f282502..f6f4de6df 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i16.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i16.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn negate(a: i16) -> i16 { -a }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i32.snap index 6158c61af..04c17d8a1 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn negate(a: i32) -> i32 { -a }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i64.snap index add3a8ee3..40453abca 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn negate(a: i64) -> i64 { -a }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i8.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i8.snap index ebc2d0ea2..3a956b0cd 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i8.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__negate_op_i8.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn negate(a: i8) -> i8 { -a }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_private_extern_fn.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_private_extern_fn.snap index eb7188fe9..47784666e 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_private_extern_fn.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_private_extern_fn.snap @@ -1,5 +1,6 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n extern fn extern_fn() -> f32;\n\n fn private_fn() -> f32 {\n extern_fn()\n }\n\n pub fn main() -> f32 {\n private_fn()\n }\n " --- diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_private_fn.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_private_fn.snap index a02d27e7b..c0fd6779c 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_private_fn.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_private_fn.snap @@ -1,5 +1,6 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n fn nested_private_fn() -> i32 {\n 1\n }\n\n fn private_fn() -> i32 {\n nested_private_fn()\n }\n\n pub fn main() -> i32 {\n private_fn()\n }\n " --- diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_private_recursive_fn.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_private_recursive_fn.snap index 073c1a219..69f833df3 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_private_recursive_fn.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_private_recursive_fn.snap @@ -1,5 +1,6 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n fn private_fn() -> f32 {\n private_fn()\n }\n\n pub fn main() -> f32 {\n private_fn()\n }\n " --- diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_private_recursive_fn_with_args.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_private_recursive_fn_with_args.snap index 0b49219b1..d3f3c7b94 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_private_recursive_fn_with_args.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_private_recursive_fn_with_args.snap @@ -1,5 +1,6 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n extern fn other() -> i32;\n\n fn private_fn(a: i32) -> f32 {\n private_fn(a)\n }\n\n pub fn main() -> f32 {\n private_fn(other())\n }\n " --- diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_structs.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_structs.snap index 2cacbd302..ba3c428e4 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_structs.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__nested_structs.snap @@ -1,6 +1,7 @@ --- source: crates/mun_codegen/src/test.rs -expression: "\n struct(gc) GcStruct(f32, f32);\n struct(value) ValueStruct(f32, f32);\n\n struct(gc) GcWrapper(GcStruct, ValueStruct)\n struct(value) ValueWrapper(GcStruct, ValueStruct);\n\n pub fn new_gc_struct(a: f32, b: f32) -> GcStruct {\n GcStruct(a, b)\n }\n\n pub fn new_value_struct(a: f32, b: f32) -> ValueStruct {\n ValueStruct(a, b)\n }\n\n pub fn new_gc_wrapper(a: GcStruct, b: ValueStruct) -> GcWrapper {\n GcWrapper(a, b)\n }\n\n pub fn new_value_wrapper(a: GcStruct, b: ValueStruct) -> ValueWrapper {\n ValueWrapper(a, b)\n }\n " +assertion_line: 1045 +expression: "\n pub struct(gc) GcStruct(f32, f32);\n pub struct(value) ValueStruct(f32, f32);\n\n pub struct(gc) GcWrapper(GcStruct, ValueStruct)\n pub struct(value) ValueWrapper(GcStruct, ValueStruct);\n\n pub fn new_gc_struct(a: f32, b: f32) -> GcStruct {\n GcStruct(a, b)\n }\n\n pub fn new_value_struct(a: f32, b: f32) -> ValueStruct {\n ValueStruct(a, b)\n }\n\n pub fn new_gc_wrapper(a: GcStruct, b: ValueStruct) -> GcWrapper {\n GcWrapper(a, b)\n }\n\n pub fn new_value_wrapper(a: GcStruct, b: ValueStruct) -> ValueWrapper {\n ValueWrapper(a, b)\n }\n " --- ; == FILE IR (mod) ===================================== diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__never_conditional_return_expr.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__never_conditional_return_expr.snap index c03e89913..012196e2d 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__never_conditional_return_expr.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__never_conditional_return_expr.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn main(a:i32) -> i32 {\n if a > 4 {\n return a;\n } else {\n return a - 1;\n }\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__private_fn_only.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__private_fn_only.snap index 46a8855d0..9f991dd05 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__private_fn_only.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__private_fn_only.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n fn private_main() {\n let a = 1;\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__return_expr.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__return_expr.snap index e7c6e4467..00f3cca81 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__return_expr.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__return_expr.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn main() -> i32 {\n return 5;\n let a = 3; // Nothing regarding this statement should be in the IR\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__return_type.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__return_type.snap index 0621bed69..2f81689f4 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__return_type.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__return_type.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn main() -> i32 {\n 0\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__shadowing.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__shadowing.snap index ec9cd2fb2..04a353aa8 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__shadowing.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__shadowing.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn foo(a:i32) -> i32 {\n let a = a+1;\n {\n let a = a+2;\n }\n a+3\n }\n\n pub fn bar(a:i32) -> i32 {\n let a = a+1;\n let a = {\n let a = a+2;\n a\n }\n a+3\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i128.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i128.snap index fa1e5ec29..0dac6f8a9 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i128.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i128.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn leftshift(a: i128, b: i128) -> i128 { a << b }\n pub fn rightshift(a: i128, b: i128) -> i128 { a >> b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i16.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i16.snap index bc922489c..867c17455 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i16.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i16.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn leftshift(a: i16, b: i16) -> i16 { a << b }\n pub fn rightshift(a: i16, b: i16) -> i16 { a >> b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i32.snap index 58a5323e1..370500ee9 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn leftshift(a: i32, b: i32) -> i32 { a << b }\n pub fn rightshift(a: i32, b: i32) -> i32 { a >> b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i64.snap index 57415b293..5808fd808 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn leftshift(a: i64, b: i64) -> i64 { a << b }\n pub fn rightshift(a: i64, b: i64) -> i64 { a >> b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i8.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i8.snap index 1073f4c15..ff59b90cc 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i8.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_i8.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn leftshift(a: i8, b: i8) -> i8 { a << b }\n pub fn rightshift(a: i8, b: i8) -> i8 { a >> b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u128.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u128.snap index b82bb8b03..cf4cc8f06 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u128.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u128.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn leftshift(a: u128, b: u128) -> u128 { a << b }\n pub fn rightshift(a: u128, b: u128) -> u128 { a >> b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u16.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u16.snap index 74679a7cc..998b99da7 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u16.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u16.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn leftshift(a: u16, b: u16) -> u16 { a << b }\n pub fn rightshift(a: u16, b: u16) -> u16 { a >> b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u32.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u32.snap index 38a1e1f57..0d22d994d 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u32.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u32.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn leftshift(a: u32, b: u32) -> u32 { a << b }\n pub fn rightshift(a: u32, b: u32) -> u32 { a >> b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u64.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u64.snap index f467d0d2d..fcefb87e5 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u64.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u64.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn leftshift(a: u64, b: u64) -> u64 { a << b }\n pub fn rightshift(a: u64, b: u64) -> u64 { a >> b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u8.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u8.snap index 896412e40..c5502217a 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u8.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__shift_op_u8.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn leftshift(a: u8, b: u8) -> u8 { a << b }\n pub fn rightshift(a: u8, b: u8) -> u8 { a >> b }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__struct_test.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__struct_test.snap index 8af7d4d36..7f8ba31aa 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__struct_test.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__struct_test.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n struct(value) Bar(f64, i32, bool, Foo);\n struct(value) Foo { a: i32 };\n struct(value) Baz;\n pub fn foo() {\n let a: Foo = Foo { a: 5 };\n let b: Bar = Bar(1.23, a.a, true, a);\n let c: Baz = Baz;\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__true_is_true.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__true_is_true.snap index 89559fb21..5a0180a31 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__true_is_true.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__true_is_true.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn test_true() -> bool {\n true\n }\n\n pub fn test_false() -> bool {\n false\n }" + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__update_operators.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__update_operators.snap index 68cba90fa..d19dd8cf6 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__update_operators.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__update_operators.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn add(a:i32, b:i32) -> i32 {\n let result = a\n result += b\n result\n }\n\n pub fn subtract(a:i32, b:i32) -> i32 {\n let result = a\n result -= b\n result\n }\n\n pub fn multiply(a:i32, b:i32) -> i32 {\n let result = a\n result *= b\n result\n }\n\n pub fn divide(a:i32, b:i32) -> i32 {\n let result = a\n result /= b\n result\n }\n\n pub fn remainder(a:i32, b:i32) -> i32 {\n let result = a\n result %= b\n result\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__update_parameter.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__update_parameter.snap index 5d9fea0b8..a8f372330 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__update_parameter.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__update_parameter.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn add_three(a:i32) -> i32 {\n a += 3;\n a\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__void_return.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__void_return.snap index bfaa5d6a9..add5f6807 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__void_return.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__void_return.snap @@ -1,5 +1,6 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n fn bar() {\n let a = 3;\n }\n pub fn foo(a:i32) {\n let c = bar()\n }\n " --- diff --git a/crates/mun_codegen/src/snapshots/mun_codegen__test__while_expr.snap b/crates/mun_codegen/src/snapshots/mun_codegen__test__while_expr.snap index a8c942ed9..9ebe04ce4 100644 --- a/crates/mun_codegen/src/snapshots/mun_codegen__test__while_expr.snap +++ b/crates/mun_codegen/src/snapshots/mun_codegen__test__while_expr.snap @@ -1,6 +1,8 @@ --- source: crates/mun_codegen/src/test.rs +assertion_line: 1045 expression: "\n pub fn foo(n:i32) {\n while n<3 {\n n += 1;\n };\n\n // This will be completely optimized out\n while n<4 {\n break;\n };\n }\n " + --- ; == FILE IR (mod) ===================================== ; ModuleID = 'mod' diff --git a/crates/mun_compiler/Cargo.toml b/crates/mun_compiler/Cargo.toml index e7d10ea2b..8c6222a3a 100644 --- a/crates/mun_compiler/Cargo.toml +++ b/crates/mun_compiler/Cargo.toml @@ -29,4 +29,4 @@ log = "0.4" lockfile = "0.2.2" [dev-dependencies] -insta = "1.7.1" +insta = "1.12.0" diff --git a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__access_unknown_field_error.snap b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__access_unknown_field_error.snap index 69ac65c1b..a6f4abc1f 100644 --- a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__access_unknown_field_error.snap +++ b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__access_unknown_field_error.snap @@ -1,6 +1,8 @@ --- source: crates/mun_compiler/src/diagnostics.rs +assertion_line: 85 expression: "compilation_errors(\"\\n\\nstruct Foo {\\ni: bool\\n}\\n\\nfn main() {\\nlet a = Foo { i: false };\\nlet b = a.t;\\n}\")" + --- error: no field `t` on type `Foo` --> main.mun:9:11 diff --git a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__cyclic_type_alias_error.snap b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__cyclic_type_alias_error.snap index 0f822fc91..a409ea484 100644 --- a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__cyclic_type_alias_error.snap +++ b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__cyclic_type_alias_error.snap @@ -1,6 +1,8 @@ --- source: crates/mun_compiler/src/diagnostics.rs +assertion_line: 102 expression: "compilation_errors(\"\\n\\ntype Foo = Foo;\")" + --- error: cyclic type --> main.mun:3:12 diff --git a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__duplicate_definition_error.snap b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__duplicate_definition_error.snap index df0edda7b..be3901e88 100644 --- a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__duplicate_definition_error.snap +++ b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__duplicate_definition_error.snap @@ -1,6 +1,8 @@ --- source: crates/mun_compiler/src/diagnostics.rs +assertion_line: 71 expression: "compilation_errors(\"\\n\\nfn foo(){}\\n\\nfn foo(){}\\n\\nstruct Bar;\\n\\nstruct Bar;\\n\\nfn BAZ(){}\\n\\nstruct BAZ;\")" + --- error: a value named `foo` has already been defined in this module --> main.mun:5:1 diff --git a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__expected_function.snap b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__expected_function.snap index 3e71965d7..f0d13a2f9 100644 --- a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__expected_function.snap +++ b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__expected_function.snap @@ -1,6 +1,8 @@ --- source: crates/mun_compiler/src/diagnostics.rs +assertion_line: 107 expression: "compilation_errors(\"\\n\\nfn foo() { let a = 3; a(); }\")" + --- error: expected function, found `{integer}` --> main.mun:3:23 diff --git a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__expected_function_error.snap b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__expected_function_error.snap index 95e8d17ed..fa0ec0208 100644 --- a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__expected_function_error.snap +++ b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__expected_function_error.snap @@ -1,6 +1,8 @@ --- source: crates/mun_compiler/src/diagnostics.rs +assertion_line: 57 expression: "compilation_errors(\"\\n\\nfn main() {\\nlet a = Foo();\\n\\nlet b = Bar();\\n}\")" + --- error: cannot find value `Foo` in this scope --> main.mun:4:9 diff --git a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__free_type_alias_error.snap b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__free_type_alias_error.snap index b50572480..d230a668d 100644 --- a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__free_type_alias_error.snap +++ b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__free_type_alias_error.snap @@ -1,6 +1,8 @@ --- source: crates/mun_compiler/src/diagnostics.rs +assertion_line: 92 expression: "compilation_errors(\"\\n\\ntype Foo;\")" + --- error: free type alias without type ref --> main.mun:3:1 diff --git a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__leaked_private_type_error_function.snap b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__leaked_private_type_error_function.snap index 3dbd5cfcd..da7ac0a4f 100644 --- a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__leaked_private_type_error_function.snap +++ b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__leaked_private_type_error_function.snap @@ -1,5 +1,6 @@ --- source: crates/mun_compiler/src/diagnostics.rs +assertion_line: 50 expression: "compilation_errors(\"\\n\\nstruct Foo;\\n pub fn Bar() -> Foo { Foo } \\n fn main() {}\")" --- diff --git a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__mismatched_type_error.snap b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__mismatched_type_error.snap index 946aa80c0..43b3324d1 100644 --- a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__mismatched_type_error.snap +++ b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__mismatched_type_error.snap @@ -1,6 +1,8 @@ --- source: crates/mun_compiler/src/diagnostics.rs +assertion_line: 64 expression: "compilation_errors(\"\\n\\nfn main() {\\nlet a: f64 = false;\\n\\nlet b: bool = 22;\\n}\")" + --- error: expected `f64`, found `bool` --> main.mun:4:14 diff --git a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__possibly_uninitialized_variable_error.snap b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__possibly_uninitialized_variable_error.snap index 422d65552..8361dcd66 100644 --- a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__possibly_uninitialized_variable_error.snap +++ b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__possibly_uninitialized_variable_error.snap @@ -1,6 +1,8 @@ --- source: crates/mun_compiler/src/diagnostics.rs +assertion_line: 78 expression: "compilation_errors(\"\\n\\nfn main() {\\nlet a;\\nif 5>6 {\\na = 5\\n}\\nlet b = a;\\n}\")" + --- error: use of possibly-uninitialized `a` --> main.mun:8:9 diff --git a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__syntax_error.snap b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__syntax_error.snap index 10d97f66e..845f2575c 100644 --- a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__syntax_error.snap +++ b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__syntax_error.snap @@ -1,6 +1,8 @@ --- source: crates/mun_compiler/src/diagnostics.rs +assertion_line: 31 expression: "compilation_errors(\"\\n\\nfn main(\\n struct Foo\\n\")" + --- error: syntax error --> main.mun:3:9 diff --git a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__type_alias_target_undeclared_error.snap b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__type_alias_target_undeclared_error.snap index 3bcace238..c0f2650cd 100644 --- a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__type_alias_target_undeclared_error.snap +++ b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__type_alias_target_undeclared_error.snap @@ -1,6 +1,8 @@ --- source: crates/mun_compiler/src/diagnostics.rs +assertion_line: 97 expression: "compilation_errors(\"\\n\\ntype Foo = UnknownType;\")" + --- error: cannot find type `UnknownType` in this scope --> main.mun:3:12 diff --git a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__unresolved_type_error.snap b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__unresolved_type_error.snap index dd8bb198f..9660fe3b4 100644 --- a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__unresolved_type_error.snap +++ b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__unresolved_type_error.snap @@ -1,6 +1,8 @@ --- source: crates/mun_compiler/src/diagnostics.rs +assertion_line: 43 expression: "compilation_errors(\"\\n\\nfn main() {\\nlet a = Foo{};\\n\\nlet b = Bar{};\\n}\")" + --- error: cannot find type `Foo` in this scope --> main.mun:4:9 diff --git a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__unresolved_value_error.snap b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__unresolved_value_error.snap index dc7dc6fc5..9e644a5cf 100644 --- a/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__unresolved_value_error.snap +++ b/crates/mun_compiler/src/snapshots/mun_compiler__diagnostics__tests__unresolved_value_error.snap @@ -1,6 +1,8 @@ --- source: crates/mun_compiler/src/diagnostics.rs +assertion_line: 36 expression: "compilation_errors(\"\\n\\nfn main() {\\nlet b = a;\\n\\nlet d = c;\\n}\")" + --- error: cannot find value `a` in this scope --> main.mun:4:9 diff --git a/crates/mun_hir/Cargo.toml b/crates/mun_hir/Cargo.toml index 7d613e1b8..694bdccc8 100644 --- a/crates/mun_hir/Cargo.toml +++ b/crates/mun_hir/Cargo.toml @@ -28,7 +28,7 @@ smallvec = "1.6.1" arrayvec = "0.5.2" [dev-dependencies] -insta = "1.7.1" +insta = "1.12.0" text_trees = "0.1.2" parking_lot = "0.11.1" mun_test = { path = "../mun_test" } diff --git a/crates/mun_hir/src/code_model/struct/validator/snapshots/mun_hir__code_model__r#struct__validator__tests__private_leak_struct_fields.snap b/crates/mun_hir/src/code_model/struct/validator/snapshots/mun_hir__code_model__r#struct__validator__tests__private_leak_struct_fields.snap deleted file mode 100644 index 7cae42881..000000000 --- a/crates/mun_hir/src/code_model/struct/validator/snapshots/mun_hir__code_model__r#struct__validator__tests__private_leak_struct_fields.snap +++ /dev/null @@ -1,8 +0,0 @@ ---- -source: crates/mun_hir/src/code_model/struct/validator/tests.rs -expression: "struct Foo(usize);\npub struct Bar(usize);\n\n// valid, bar is public\npub struct Baz {\n foo: Foo,\n pub bar: Bar,\n}\n\n// invalid, Foo is private\npub struct FooBar {\n pub foo: Foo,\n pub bar: Bar,\n}\n\n// valid, FooBaz is private\nstruct FooBaz {\n pub foo: Foo,\n pub bar: Bar,\n}\n\npub(crate) struct BarBaz;\n\n// invalid, exporting pub(crate) to pub\npub struct FooBarBaz {\n pub foo: Foo,\n pub bar: Bar,\n}" - ---- -179..182: can't leak private type -391..394: can't leak private type - diff --git a/crates/mun_hir/src/code_model/struct/validator/tests.rs b/crates/mun_hir/src/code_model/struct/validator/tests.rs index de892acd9..0034c34e7 100644 --- a/crates/mun_hir/src/code_model/struct/validator/tests.rs +++ b/crates/mun_hir/src/code_model/struct/validator/tests.rs @@ -3,7 +3,7 @@ use crate::utils::tests::*; #[test] fn test_private_leak_struct_fields() { - diagnostics_snapshot( + insta::assert_snapshot!(diagnostics( r#" struct Foo(usize); @@ -34,14 +34,9 @@ fn test_private_leak_struct_fields() { pub foo: Foo, pub bar: Bar, } - "#, - ) -} - -// this function needs to be declared in each file separately -// since insta's AutoName creates files in the directory from which -// the macro is called. -fn diagnostics_snapshot(text: &str) { - let text = text.trim().replace("\n ", "\n"); - insta::assert_snapshot!(insta::_macro_support::AutoName, diagnostics(&text), &text); + "#), + @r###" + 180..183: can't leak private type + 392..395: can't leak private type + "###) } diff --git a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__free_type_alias_without_type_ref.snap b/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__free_type_alias_without_type_ref.snap deleted file mode 100644 index a92fd5072..000000000 --- a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__free_type_alias_without_type_ref.snap +++ /dev/null @@ -1,6 +0,0 @@ ---- -source: crates/mun_hir/src/expr/validator/tests.rs -expression: "type Foo; // `Foo` must have a target type" ---- -0..9: free type alias without type ref - diff --git a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_alias.snap b/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_alias.snap deleted file mode 100644 index 4b0d62458..000000000 --- a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_alias.snap +++ /dev/null @@ -1,6 +0,0 @@ ---- -source: crates/mun_hir/src/expr/validator/tests.rs -expression: "type Bar = usize;\n\n// Illegal, Bar has a smaller scope than this function\npub fn baz() -> Bar {\n 0\n}" - ---- - diff --git a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_basic.snap b/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_basic.snap deleted file mode 100644 index c0c5ca527..000000000 --- a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_basic.snap +++ /dev/null @@ -1,9 +0,0 @@ ---- -source: crates/mun_hir/src/expr/validator/tests.rs -expression: "struct Foo(usize);\npub fn bar() -> Foo { // Foo is not private\n Foo(0)\n}\n\npub fn baz(a: Foo) -> usize { // Foo is not private\n 0\n}\n\nfn foobar() -> Foo { // Function is private so this should pass\n Foo(0)\n}\n\npub struct FooBaz(usize);\n\npub fn BarBaz(a: Foo) -> usize {\n 0\n}\n\nfn BazFoo(a: Foo) -> usize {\n 0\n}" - ---- -18..75: exported private type -77..136: exported private type -243..283: exported private type - diff --git a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_function_args.snap b/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_function_args.snap deleted file mode 100644 index 245e8684b..000000000 --- a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_function_args.snap +++ /dev/null @@ -1,8 +0,0 @@ ---- -source: crates/mun_hir/src/expr/validator/tests.rs -expression: "struct Foo(usize);\n\npub fn bar(a: Foo, b: isize) -> usize{ // Foo is not public\n 0\n}\n\npub fn baz(a: isize, b: Foo) -> isize {\n -1\n}\n\npub struct FooBar(usize);\n\npub fn FooBaz(a: FooBar) -> FooBar {\n a\n}\n\nfn BarBaz(a: isize, b: FooBar) -> isize {\n a\n}" - ---- -34..37: can't leak private type -113..116: can't leak private type - diff --git a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_function_return.snap b/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_function_return.snap deleted file mode 100644 index 0a250b5b4..000000000 --- a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_function_return.snap +++ /dev/null @@ -1,8 +0,0 @@ ---- -source: crates/mun_hir/src/expr/validator/tests.rs -expression: "struct Foo(usize);\n\npub fn bar() -> Foo { // Foo is not public\n Foo(0)\n}\n\npub fn baz(a: usize, b: usize) -> Foo {\n Foo(2)\n}\n\npub struct FooBar(usize);\n\npub fn FooBaz() -> FooBar {\n FooBar(0)\n}\n\nfn BarBaz() -> FooBar {\n FooBar(1)\n}" - ---- -36..39: can't leak private type -111..114: can't leak private type - diff --git a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_function_scoped.snap b/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_function_scoped.snap deleted file mode 100644 index 72b15caff..000000000 --- a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_function_scoped.snap +++ /dev/null @@ -1,7 +0,0 @@ ---- -source: crates/mun_hir/src/expr/validator/tests.rs -expression: "// Illegal, Bar has a smaller scope that this use statement\npub(super) struct Bar;\n\n// Illegal, Bar has a smaller scope than this function\npub fn baz() -> Bar {\n Bar\n}" - ---- -155..158: can't leak private type - diff --git a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_functions.snap b/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_functions.snap deleted file mode 100644 index c0c5ca527..000000000 --- a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__private_leak_functions.snap +++ /dev/null @@ -1,9 +0,0 @@ ---- -source: crates/mun_hir/src/expr/validator/tests.rs -expression: "struct Foo(usize);\npub fn bar() -> Foo { // Foo is not private\n Foo(0)\n}\n\npub fn baz(a: Foo) -> usize { // Foo is not private\n 0\n}\n\nfn foobar() -> Foo { // Function is private so this should pass\n Foo(0)\n}\n\npub struct FooBaz(usize);\n\npub fn BarBaz(a: Foo) -> usize {\n 0\n}\n\nfn BazFoo(a: Foo) -> usize {\n 0\n}" - ---- -18..75: exported private type -77..136: exported private type -243..283: exported private type - diff --git a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__uninitialized_access.snap b/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__uninitialized_access.snap deleted file mode 100644 index bbb3243d7..000000000 --- a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__uninitialized_access.snap +++ /dev/null @@ -1,6 +0,0 @@ ---- -source: crates/mun_hir/src/expr/validator/tests.rs -expression: "fn foo() {\n let a:int;\n let b = a + 3;\n}" ---- -38..39: use of possibly-uninitialized variable - diff --git a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__uninitialized_access_if.snap b/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__uninitialized_access_if.snap deleted file mode 100644 index 2bf0bb68b..000000000 --- a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__uninitialized_access_if.snap +++ /dev/null @@ -1,6 +0,0 @@ ---- -source: crates/mun_hir/src/expr/validator/tests.rs -expression: "fn foo() {\n let a:int;\n if true { a = 3; } else { a = 4; }\n let b = a + 4; // correct, `a` is initialized either way\n}\n\nfn bar() {\n let a:int;\n if true { a = 3; }\n let b = a + 4; // `a` is possibly-unitialized\n}\n\nfn baz() {\n let a:int;\n if true { return } else { a = 4 };\n let b = a + 4; // correct, `a` is initialized either way\n}\n\nfn foz() {\n let a:int;\n if true { a = 4 } else { return };\n let b = a + 4; // correct, `a` is initialized either way\n}\n\nfn boz() {\n let a:int;\n return;\n let b = a + 4; // `a` is not initialized but this is dead code anyway\n}" ---- -191..192: use of possibly-uninitialized variable - diff --git a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__uninitialized_access_while.snap b/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__uninitialized_access_while.snap deleted file mode 100644 index 06a7bf67b..000000000 --- a/crates/mun_hir/src/expr/validator/snapshots/mun_hir__expr__validator__tests__uninitialized_access_while.snap +++ /dev/null @@ -1,6 +0,0 @@ ---- -source: crates/mun_hir/src/expr/validator/tests.rs -expression: "fn foo(b:int) {\n let a:int;\n while b < 4 { b += 1; a = b; a += 1; }\n let c = a + 4; // `a` is possibly-unitialized\n}" ---- -86..87: use of possibly-uninitialized variable - diff --git a/crates/mun_hir/src/expr/validator/tests.rs b/crates/mun_hir/src/expr/validator/tests.rs index c5bebaf2d..67ff8810d 100644 --- a/crates/mun_hir/src/expr/validator/tests.rs +++ b/crates/mun_hir/src/expr/validator/tests.rs @@ -3,19 +3,19 @@ use crate::utils::tests::*; #[test] fn test_uninitialized_access() { - diagnostics_snapshot( - r#" + insta::assert_snapshot!( + diagnostics(r#" fn foo() { let a:int; let b = a + 3; } - "#, - ) + "#), @"38..39: use of possibly-uninitialized variable" + ); } #[test] fn test_uninitialized_access_if() { - diagnostics_snapshot( + insta::assert_snapshot!(diagnostics( r#" fn foo() { let a:int; @@ -47,12 +47,12 @@ fn test_uninitialized_access_if() { let b = a + 4; // `a` is not initialized but this is dead code anyway } "#, - ) + ), @"191..192: use of possibly-uninitialized variable"); } #[test] fn test_uninitialized_access_while() { - diagnostics_snapshot( + insta::assert_snapshot!(diagnostics( r#" fn foo(b:int) { let a:int; @@ -60,21 +60,21 @@ fn test_uninitialized_access_while() { let c = a + 4; // `a` is possibly-unitialized } "#, - ) + ), @"86..87: use of possibly-uninitialized variable"); } #[test] fn test_free_type_alias_without_type_ref() { - diagnostics_snapshot( + insta::assert_snapshot!(diagnostics( r#" type Foo; // `Foo` must have a target type "#, - ) + ), @"0..9: free type alias without type ref"); } #[test] fn test_private_leak_function_return() { - diagnostics_snapshot( + insta::assert_snapshot!(diagnostics( r#" struct Foo(usize); @@ -96,12 +96,15 @@ fn test_private_leak_function_return() { FooBar(1) } "#, - ) + ), @r###" + 36..39: can't leak private type + 111..114: can't leak private type + "###); } #[test] fn test_private_leak_function_args() { - diagnostics_snapshot( + insta::assert_snapshot!(diagnostics( r#" struct Foo(usize); @@ -123,12 +126,15 @@ fn test_private_leak_function_args() { a } "#, - ) + ), @r###" + 34..37: can't leak private type + 113..116: can't leak private type + "###); } #[test] fn test_private_leak_function_scoped() { - diagnostics_snapshot( + insta::assert_snapshot!(diagnostics( r#" // Illegal, Bar has a smaller scope than this use statement pub(super) struct Bar; @@ -138,13 +144,13 @@ fn test_private_leak_function_scoped() { Bar } "#, - ) + ), @"155..158: can't leak private type"); } // No errors, check https://github.com/mun-lang/mun/issues/339 #[test] fn test_private_leak_alias() { - diagnostics_snapshot( + insta::assert_snapshot!(diagnostics( r#" type Bar = usize; @@ -152,13 +158,5 @@ fn test_private_leak_alias() { 0 } "#, - ) -} - -// this function needs to be declared in each file separately -// since insta's AutoName creates files in the directory from which -// the macro is called. -fn diagnostics_snapshot(text: &str) { - let text = text.trim().replace("\n ", "\n"); - insta::assert_snapshot!(insta::_macro_support::AutoName, diagnostics(&text), &text); + ), @""); } diff --git a/crates/mun_hir/src/item_tree/snapshots/mun_hir__item_tree__tests__top_level_items.snap b/crates/mun_hir/src/item_tree/snapshots/mun_hir__item_tree__tests__top_level_items.snap index 6cf819d3c..35056ff6b 100644 --- a/crates/mun_hir/src/item_tree/snapshots/mun_hir__item_tree__tests__top_level_items.snap +++ b/crates/mun_hir/src/item_tree/snapshots/mun_hir__item_tree__tests__top_level_items.snap @@ -1,6 +1,8 @@ --- source: crates/mun_hir/src/item_tree/tests.rs +assertion_line: 61 expression: "print_item_tree(r#\"\n fn foo(a:i32, b:u8, c:String) -> i32 {}\n pub fn bar(a:i32, b:u8, c:String) -> {}\n pub(super) fn bar(a:i32, b:u8, c:String) -> {}\n pub(package) fn baz(a:i32, b:, c:String) -> {}\n extern fn eval(a:String) -> bool;\n\n struct Foo {\n a: i32,\n b: u8,\n c: String,\n }\n struct Foo2 {\n a: i32,\n b: ,\n c: String,\n }\n struct Bar (i32, u32, String)\n struct Baz;\n\n type FooBar = Foo;\n type FooBar = package::Foo;\n \"#).unwrap()" + --- top-level items: Function { name: Name(Text("foo")), visibility: RawVisibilityId("pub(self)"), is_extern: false, params: [Path(Path { kind: Plain, segments: [Name(Text("i32"))] }), Path(Path { kind: Plain, segments: [Name(Text("u8"))] }), Path(Path { kind: Plain, segments: [Name(Text("String"))] })], ret_type: Path(Path { kind: Plain, segments: [Name(Text("i32"))] }), ast_id: FileAstId { raw: Idx::(0), _ty: PhantomData } } diff --git a/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_.snap b/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_.snap deleted file mode 100644 index 0aadc8aae..000000000 --- a/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: crates/mun_hir/src/package_defs/tests.rs -expression: "//- /bar.mun\nuse package::Foo;\npub struct Bar(Foo);\n\n//- /mod.mun\npub use foo::Foo; // Re-export a child's definition\n\nstruct Baz;\n\n//- /foo.mun\nuse package::{bar::Bar, Baz};\n\npub struct Foo {\n baz: Baz, // Can use private definitions from any of its ancestors\n}\n\npub fn foo_from_bar(bar: Bar) -> Foo {\n bar.0\n}" ---- -mod mod -+-- struct Baz -+-- use struct package::foo::Foo -+-- mod bar -| +-- struct Bar -| '-- use struct package::foo::Foo -'-- mod foo - +-- fn foo_from_bar - +-- struct Foo - +-- use struct package::Baz - '-- use struct package::bar::Bar diff --git a/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_alias.snap b/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_alias.snap deleted file mode 100644 index dc924e051..000000000 --- a/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_alias.snap +++ /dev/null @@ -1,12 +0,0 @@ ---- -source: crates/mun_hir/src/package_defs/tests.rs -expression: "//- /foo.mun\npub struct Ok;\n\n//- /bar.mun\npub use package::foo::Ok as ReallyOk;\n\npub struct Ok;\n\n//- /baz.mun\nuse package::bar::ReallyOk;" ---- -mod mod -+-- mod bar -| +-- struct Ok -| '-- use struct package::foo::Ok -+-- mod baz -| '-- use struct package::foo::Ok -'-- mod foo - '-- struct Ok diff --git a/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_cyclic.snap b/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_cyclic.snap deleted file mode 100644 index 6559ba942..000000000 --- a/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_cyclic.snap +++ /dev/null @@ -1,14 +0,0 @@ ---- -source: crates/mun_hir/src/package_defs/tests.rs -expression: "//- /foo.mun\nuse super::baz::Cyclic;\n\npub struct Ok;\n\n//- /bar.mun\nuse super::foo::{Cyclic, Ok};\n\n//- /baz.mun\nuse super::bar::{Cyclic, Ok};" ---- -mod mod -+-- mod bar -| +-- ERROR: 17..23: unresolved import -| '-- use struct package::foo::Ok -+-- mod baz -| +-- ERROR: 17..23: unresolved import -| '-- use struct package::foo::Ok -'-- mod foo - +-- ERROR: 4..22: unresolved import - '-- struct Ok diff --git a/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_cyclic_wildcard.snap b/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_cyclic_wildcard.snap deleted file mode 100644 index cb15df62d..000000000 --- a/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_cyclic_wildcard.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: crates/mun_hir/src/package_defs/tests.rs -expression: "//- /foo.mun\npub use super::baz::*;\n\npub struct Ok;\n\n//- /baz.mun\npub use super::foo::{self, *};" ---- -mod mod -+-- mod baz -| +-- use struct package::foo::Ok -| '-- use mod package::foo -'-- mod foo - +-- struct Ok - '-- use mod package::foo diff --git a/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_duplicate_name.snap b/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_duplicate_name.snap deleted file mode 100644 index 68209a36c..000000000 --- a/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_duplicate_name.snap +++ /dev/null @@ -1,10 +0,0 @@ ---- -source: crates/mun_hir/src/package_defs/tests.rs -expression: "//- /foo.mun\npub struct Ok;\n\n//- /bar.mun\nuse package::foo::Ok;\n\npub struct Ok;" ---- -mod mod -+-- mod bar -| +-- ERROR: 4..20: a second item with the same name imported. Try to use an alias. -| '-- struct Ok -'-- mod foo - '-- struct Ok diff --git a/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_self.snap b/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_self.snap deleted file mode 100644 index 571b8cde5..000000000 --- a/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_self.snap +++ /dev/null @@ -1,10 +0,0 @@ ---- -source: crates/mun_hir/src/package_defs/tests.rs -expression: "//- /foo.mun\npub struct Ok;\n\n//- /bar.mun\nuse super::foo::{self};\nuse foo::Ok;" ---- -mod mod -+-- mod bar -| +-- use struct package::foo::Ok -| '-- use mod package::foo -'-- mod foo - '-- struct Ok diff --git a/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_unresolved.snap b/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_unresolved.snap deleted file mode 100644 index 2fb73df29..000000000 --- a/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_unresolved.snap +++ /dev/null @@ -1,10 +0,0 @@ ---- -source: crates/mun_hir/src/package_defs/tests.rs -expression: "//- /foo.mun\npub struct Foo;\n\n//- /mod.mun\nuse foo::Foo; // works\nuse foo::Bar; // doesnt work (Bar does not exist)\nuse baz::Baz; // doesnt work (baz does not exist)" ---- -mod mod -+-- ERROR: 29..37: unresolved import -+-- ERROR: 81..89: unresolved import -+-- use struct package::foo::Foo -'-- mod foo - '-- struct Foo diff --git a/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_wildcard.snap b/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_wildcard.snap deleted file mode 100644 index a793b22fd..000000000 --- a/crates/mun_hir/src/package_defs/snapshots/mun_hir__package_defs__tests__use_wildcard.snap +++ /dev/null @@ -1,13 +0,0 @@ ---- -source: crates/mun_hir/src/package_defs/tests.rs -expression: "//- /foo.mun\npub struct Foo;\n\n//- /foo/bar.mun\npub use super::Foo;\npub struct FooBar;\n\n//- /bar.mun\nuse package::foo::bar::*; // Should reference two structs (Foo and FooBar)" ---- -mod mod -+-- mod bar -| +-- use struct package::foo::Foo -| '-- use struct package::foo::bar::FooBar -'-- mod foo - +-- struct Foo - '-- mod bar - +-- struct FooBar - '-- use struct package::foo::Foo diff --git a/crates/mun_hir/src/package_defs/tests.rs b/crates/mun_hir/src/package_defs/tests.rs index 65907b506..18f80f348 100644 --- a/crates/mun_hir/src/package_defs/tests.rs +++ b/crates/mun_hir/src/package_defs/tests.rs @@ -7,7 +7,7 @@ use rustc_hash::FxHashSet; #[test] fn use_alias() { - resolve_snapshot( + insta::assert_snapshot!(resolve( r#" //- /foo.mun pub struct Ok; @@ -19,13 +19,22 @@ fn use_alias() { //- /baz.mun use package::bar::ReallyOk; - "#, - ) + "#), + @r###" + mod mod + +-- mod bar + | +-- struct Ok + | '-- use struct package::foo::Ok + +-- mod baz + | '-- use struct package::foo::Ok + '-- mod foo + '-- struct Ok + "###); } #[test] fn use_duplicate_name() { - resolve_snapshot( + insta::assert_snapshot!(resolve( r#" //- /foo.mun pub struct Ok; @@ -34,13 +43,20 @@ fn use_duplicate_name() { use package::foo::Ok; pub struct Ok; - "#, - ) + "#), + @r###" + mod mod + +-- mod bar + | +-- ERROR: 4..20: a second item with the same name imported. Try to use an alias. + | '-- struct Ok + '-- mod foo + '-- struct Ok + "###); } #[test] fn use_cyclic_wildcard() { - resolve_snapshot( + insta::assert_snapshot!(resolve( r#" //- /foo.mun pub use super::baz::*; @@ -49,13 +65,21 @@ fn use_cyclic_wildcard() { //- /baz.mun pub use super::foo::{self, *}; - "#, - ) + "#), + @r###" + mod mod + +-- mod baz + | +-- use struct package::foo::Ok + | '-- use mod package::foo + '-- mod foo + +-- struct Ok + '-- use mod package::foo + "###); } #[test] fn use_wildcard() { - resolve_snapshot( + insta::assert_snapshot!(resolve( r#" //- /foo.mun pub struct Foo; @@ -66,13 +90,23 @@ fn use_wildcard() { //- /bar.mun use package::foo::bar::*; // Should reference two structs (Foo and FooBar) - "#, - ) + "#), + @r###" + mod mod + +-- mod bar + | +-- use struct package::foo::Foo + | '-- use struct package::foo::bar::FooBar + '-- mod foo + +-- struct Foo + '-- mod bar + +-- struct FooBar + '-- use struct package::foo::Foo + "###); } #[test] fn use_self() { - resolve_snapshot( + insta::assert_snapshot!(resolve( r#" //- /foo.mun pub struct Ok; @@ -80,13 +114,20 @@ fn use_self() { //- /bar.mun use super::foo::{self}; use foo::Ok; - "#, - ) + "#), + @r###" + mod mod + +-- mod bar + | +-- use struct package::foo::Ok + | '-- use mod package::foo + '-- mod foo + '-- struct Ok + "###); } #[test] fn use_cyclic() { - resolve_snapshot( + insta::assert_snapshot!(resolve( r#" //- /foo.mun use super::baz::Cyclic; @@ -98,13 +139,24 @@ fn use_cyclic() { //- /baz.mun use super::bar::{Cyclic, Ok}; - "#, - ) + "#), + @r###" + mod mod + +-- mod bar + | +-- ERROR: 17..23: unresolved import + | '-- use struct package::foo::Ok + +-- mod baz + | +-- ERROR: 17..23: unresolved import + | '-- use struct package::foo::Ok + '-- mod foo + +-- ERROR: 4..22: unresolved import + '-- struct Ok + "###); } #[test] fn use_unresolved() { - resolve_snapshot( + insta::assert_snapshot!(resolve( r#" //- /foo.mun pub struct Foo; @@ -113,13 +165,20 @@ fn use_unresolved() { use foo::Foo; // works use foo::Bar; // doesnt work (Bar does not exist) use baz::Baz; // doesnt work (baz does not exist) - "#, - ) + "#), + @r###" + mod mod + +-- ERROR: 29..37: unresolved import + +-- ERROR: 81..89: unresolved import + +-- use struct package::foo::Foo + '-- mod foo + '-- struct Foo + "###); } #[test] fn use_() { - resolve_snapshot( + insta::assert_snapshot!(resolve( r#" //- /bar.mun use package::Foo; @@ -140,14 +199,20 @@ fn use_() { pub fn foo_from_bar(bar: Bar) -> Foo { bar.0 } - "#, - ) -} - -fn resolve_snapshot(text: &str) { - let text = text.trim().replace("\n ", "\n"); - let resolved = resolve(&text); - insta::assert_snapshot!(insta::_macro_support::AutoName, resolved.trim(), &text); + "#), + @r###" + mod mod + +-- struct Baz + +-- use struct package::foo::Foo + +-- mod bar + | +-- struct Bar + | '-- use struct package::foo::Foo + '-- mod foo + +-- fn foo_from_bar + +-- struct Foo + +-- use struct package::Baz + '-- use struct package::bar::Bar + "###); } fn resolve(content: &str) -> String { diff --git a/crates/mun_hir/src/snapshots/mun_hir__module_tree__test__module_tree.snap b/crates/mun_hir/src/snapshots/mun_hir__module_tree__test__module_tree.snap index 235cdffc6..ddc1e1f23 100644 --- a/crates/mun_hir/src/snapshots/mun_hir__module_tree__test__module_tree.snap +++ b/crates/mun_hir/src/snapshots/mun_hir__module_tree__test__module_tree.snap @@ -1,6 +1,8 @@ --- source: crates/mun_hir/src/module_tree.rs +assertion_line: 255 expression: module_tree + --- ModuleTree { root: Idx::(0), diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__comparison_not_implemented_for_struct.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__comparison_not_implemented_for_struct.snap deleted file mode 100644 index 2c1987b05..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__comparison_not_implemented_for_struct.snap +++ /dev/null @@ -1,9 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "struct Foo;\n\nfn main() -> bool {\n Foo == Foo\n}" ---- -37..47: cannot apply binary operator -31..49 '{ ... Foo }': bool -37..40 'Foo': Foo -37..47 'Foo == Foo': bool -44..47 'Foo': Foo diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__extern_fn.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__extern_fn.snap deleted file mode 100644 index 40c5121f5..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__extern_fn.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "extern fn foo(a:i32, b:i32) -> i32;\nfn main() {\n foo(3,4);\n}\n\nextern fn with_body() {} // extern functions cannot have bodies\n\nstruct S;\nextern fn with_non_primitive(s:S); // extern functions can only have primitives as parameters\nextern fn with_non_primitive_return() -> S; // extern functions can only have primitives as parameters" ---- -65..89: extern functions cannot have bodies -174..175: extern functions can only have primitives as parameter- and return types -279..280: extern functions can only have primitives as parameter- and return types -14..15 'a': i32 -21..22 'b': i32 -46..63 '{ ...,4); }': () -52..55 'foo': function foo(i32, i32) -> i32 -52..60 'foo(3,4)': i32 -56..57 '3': i32 -58..59 '4': i32 -87..89 '{}': () -172..173 's': S diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_basics.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_basics.snap deleted file mode 100644 index 2b932a321..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_basics.snap +++ /dev/null @@ -1,13 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "fn test(a:i32, b:f64, c:never, d:bool) -> bool {\n a;\n b;\n c;\n d\n}" ---- -8..9 'a': i32 -15..16 'b': f64 -22..23 'c': never -31..32 'd': bool -47..77 '{ ... d }': never -53..54 'a': i32 -60..61 'b': f64 -67..68 'c': never -74..75 'd': bool diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_branching.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_branching.snap deleted file mode 100644 index 90d2a1bac..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_branching.snap +++ /dev/null @@ -1,42 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "fn test() {\n let a = if true { 3 } else { 4 }\n let b = if true { 3 } // Missing else branch\n let c = if true { 3; }\n let d = if true { 5 } else if false { 3 } else { 4 }\n let e = if true { 5.0 } else { 5 } // Mismatched branches\n}" ---- -61..74: missing else branch -208..234: mismatched branches -10..260 '{ ...ches }': () -20..21 'a': i32 -24..48 'if tru... { 4 }': i32 -27..31 'true': bool -32..37 '{ 3 }': i32 -34..35 '3': i32 -43..48 '{ 4 }': i32 -45..46 '4': i32 -57..58 'b': () -61..74 'if true { 3 }': () -64..68 'true': bool -69..74 '{ 3 }': i32 -71..72 '3': i32 -120..121 'c': () -124..138 'if true { 3; }': () -127..131 'true': bool -132..138 '{ 3; }': () -134..135 '3': i32 -147..148 'd': i32 -151..195 'if tru... { 4 }': i32 -154..158 'true': bool -159..164 '{ 5 }': i32 -161..162 '5': i32 -170..195 'if fal... { 4 }': i32 -173..178 'false': bool -179..184 '{ 3 }': i32 -181..182 '3': i32 -190..195 '{ 4 }': i32 -192..193 '4': i32 -204..205 'e': f64 -208..234 'if tru... { 5 }': f64 -211..215 'true': bool -216..223 '{ 5.0 }': f64 -218..221 '5.0': f64 -229..234 '{ 5 }': i32 -231..232 '5': i32 diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_break.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_break.snap deleted file mode 100644 index 18f538176..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_break.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "fn foo()->i32 {\n break; // error: not in a loop\n loop { break 3; break 3.0; } // error: mismatched type\n let a:i32 = loop { break 3.0; } // error: mismatched type\n loop { break 3; }\n let a:i32 = loop { break loop { break 3; } }\n loop { break loop { break 3.0; } } // error: mismatched type\n}" ---- -20..25: `break` outside of a loop -71..80: mismatched type -133..142: mismatched type -267..276: mismatched type -14..309 '{ ...type }': never -20..25 'break': never -55..83 'loop {...3.0; }': i32 -60..83 '{ brea...3.0; }': never -62..69 'break 3': never -68..69 '3': i32 -71..80 'break 3.0': never -77..80 '3.0': f64 -118..119 'a': i32 -126..145 'loop {...3.0; }': i32 -131..145 '{ break 3.0; }': never -133..142 'break 3.0': never -139..142 '3.0': f64 -176..193 'loop {...k 3; }': i32 -181..193 '{ break 3; }': never -183..190 'break 3': never -189..190 '3': i32 -202..203 'a': i32 -210..242 'loop {...3; } }': i32 -215..242 '{ brea...3; } }': never -217..240 'break ...k 3; }': never -223..240 'loop {...k 3; }': i32 -228..240 '{ break 3; }': never -230..237 'break 3': never -236..237 '3': i32 -247..281 'loop {...0; } }': i32 -252..281 '{ brea...0; } }': never -254..279 'break ...3.0; }': never -260..279 'loop {...3.0; }': i32 -265..279 '{ break 3.0; }': never -267..276 'break 3.0': never -273..276 '3.0': f64 diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_conditional_return.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_conditional_return.snap deleted file mode 100644 index 60398ff0f..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_conditional_return.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "fn foo(a:int)->i32 {\n if a > 4 {\n return 4;\n }\n a\n}\n\nfn bar(a:i32)->i32 {\n if a > 4 {\n return 4;\n } else {\n return 1;\n }\n}" ---- -9..12: undefined type -7..8 'a': {unknown} -19..67 '{ ... a }': i32 -25..59 'if a >... }': () -28..29 'a': {unknown} -28..33 'a > 4': bool -32..33 '4': i32 -34..59 '{ ... }': never -44..52 'return 4': never -51..52 '4': i32 -64..65 'a': {unknown} -76..77 'a': i32 -88..161 '{ ... } }': i32 -94..159 'if a >... }': i32 -97..98 'a': i32 -97..102 'a > 4': bool -101..102 '4': i32 -103..128 '{ ... }': never -113..121 'return 4': never -120..121 '4': i32 -134..159 '{ ... }': never -144..152 'return 1': never -151..152 '1': i32 diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_invalid_struct_type.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_invalid_struct_type.snap deleted file mode 100644 index 788833d7a..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_invalid_struct_type.snap +++ /dev/null @@ -1,9 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "fn main(){\n let a = Foo {b: 3};\n}" ---- -23..26: undefined type -9..36 '{ ... 3}; }': () -19..20 'a': {unknown} -23..33 'Foo {b: 3}': {unknown} -31..32 '3': i32 diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_literals.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_literals.snap deleted file mode 100644 index 257563ee9..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_literals.snap +++ /dev/null @@ -1,14 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "fn integer() -> i32 {\n 0\n }\n\n fn large_unsigned_integer() -> u128 {\n 0\n }\n\n fn with_let() -> u16 {\n let b = 4;\n let a = 4;\n a\n }" ---- -20..37 '{ ... }': i32 -30..31 '0': i32 -79..96 '{ ... }': u128 -89..90 '0': u128 -123..178 '{ ... }': u16 -137..138 'b': i32 -141..142 '4': i32 -156..157 'a': u16 -160..161 '4': u16 -171..172 'a': u16 diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_loop.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_loop.snap deleted file mode 100644 index 4df9ba2dd..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_loop.snap +++ /dev/null @@ -1,7 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "fn foo() {\n loop {}\n}" ---- -9..24 '{ loop {} }': never -15..22 'loop {}': never -20..22 '{}': () diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_return.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_return.snap deleted file mode 100644 index 3f771e72f..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_return.snap +++ /dev/null @@ -1,9 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "fn test()->i32 {\n return; // error: mismatched type\n return 5;\n}" ---- -21..27: `return;` in a function whose return type is not `()` -15..70 '{ ...n 5; }': never -21..27 'return': never -59..67 'return 5': never -66..67 '5': i32 diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_suffix_literals.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_suffix_literals.snap deleted file mode 100644 index 0363ad1bf..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_suffix_literals.snap +++ /dev/null @@ -1,48 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "fn main(){\n 123;\n 123u8;\n 123u16;\n 123u32;\n 123u64;\n 123u128;\n 1_000_000_u32;\n 123i8;\n 123i16;\n 123i32;\n 123i64;\n 123i128;\n 1_000_000_i32;\n 1_000_123.0e-2;\n 1_000_123.0e-2f32;\n 1_000_123.0e-2f64;\n 9999999999999999999999999999999999999999999_f64;\n}\n\nfn add(a:u32) -> u32 {\n a + 12u32\n}\n\nfn errors() {\n 0b22222; // invalid literal\n 0b00010_f32; // non-10 base f64\n 0o71234_f32; // non-10 base f64\n 1234_foo; // invalid suffix\n 1234.0_bar; // invalid suffix\n 9999999999999999999999999999999999999999999; // too large\n 256_u8; // literal out of range for `u8`\n 128_i8; // literal out of range for `i8`\n 12712371237123_u32; // literal out of range `u32`\n 9999999999999999999999999; // literal out of range `i32`\n}" ---- -358..365: invalid literal value -390..401: binary float literal is not supported -426..437: octal float literal is not supported -462..470: invalid suffix `foo` -494..504: invalid suffix `bar` -528..571: int literal is too large -590..596: literal out of range for `u8` -635..641: literal out of range for `i8` -680..698: literal out of range for `u32` -734..759: literal out of range for `i32` -9..298 '{ ...f64; }': () -15..18 '123': i32 -24..29 '123u8': u8 -35..41 '123u16': u16 -47..53 '123u32': u32 -59..65 '123u64': u64 -71..78 '123u128': u128 -84..97 '1_000_000_u32': u32 -103..108 '123i8': i8 -114..120 '123i16': i16 -126..132 '123i32': i32 -138..144 '123i64': i64 -150..157 '123i128': i128 -163..176 '1_000_000_i32': i32 -182..196 '1_000_123.0e-2': f64 -202..219 '1_000_...e-2f32': f32 -225..242 '1_000_...e-2f64': f64 -248..295 '999999...99_f64': f64 -307..308 'a': u32 -321..338 '{ ...2u32 }': u32 -327..328 'a': u32 -327..336 'a + 12u32': u32 -331..336 '12u32': u32 -352..792 '{ ...i32` }': () -358..365 '0b22222': i32 -390..401 '0b00010_f32': f32 -426..437 '0o71234_f32': f32 -462..470 '1234_foo': i32 -494..504 '1234.0_bar': f64 -528..571 '999999...999999': i32 -590..596 '256_u8': u8 -635..641 '128_i8': i8 -680..698 '127123...23_u32': u32 -734..759 '999999...999999': i32 diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_type_alias.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_type_alias.snap deleted file mode 100644 index 496909d91..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_type_alias.snap +++ /dev/null @@ -1,9 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "type Foo = i32;\ntype Bar = Foo;\ntype Baz = UnknownType; // error: undefined type\n\nfn main(a: Foo) {\n let b: Bar = a;\n}" ---- -43..54: undefined type -91..92 'a': i32 -99..122 '{ ...= a; }': () -109..110 'b': i32 -118..119 'a': i32 diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_unary_ops.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_unary_ops.snap deleted file mode 100644 index f373ce7ad..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_unary_ops.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "fn foo(a: i32, b: bool) {\n a = -a;\n b = !b;\n}" ---- -7..8 'a': i32 -15..16 'b': bool -24..51 '{ ... !b; }': () -30..31 'a': i32 -30..36 'a = -a': () -34..36 '-a': i32 -35..36 'a': i32 -42..43 'b': bool -42..48 'b = !b': () -46..48 '!b': bool -47..48 'b': bool diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_while.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_while.snap deleted file mode 100644 index 441353691..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__infer_while.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "fn foo() {\n let n = 0;\n while n < 3 { n += 1; };\n while n < 3 { n += 1; break; };\n while n < 3 { break 3; }; // error: break with value can only appear in a loop\n while n < 3 { loop { break 3; }; };\n}" ---- -109..116: `break` with value can only appear in a `loop` -9..217 '{ ...; }; }': () -19..20 'n': i32 -23..24 '0': i32 -30..53 'while ...= 1; }': () -36..37 'n': i32 -36..41 'n < 3': bool -40..41 '3': i32 -42..53 '{ n += 1; }': () -44..45 'n': i32 -44..50 'n += 1': () -49..50 '1': i32 -59..89 'while ...eak; }': () -65..66 'n': i32 -65..70 'n < 3': bool -69..70 '3': i32 -71..89 '{ n +=...eak; }': never -73..74 'n': i32 -73..79 'n += 1': () -78..79 '1': i32 -81..86 'break': never -95..119 'while ...k 3; }': () -101..102 'n': i32 -101..106 'n < 3': bool -105..106 '3': i32 -107..119 '{ break 3; }': never -109..116 'break 3': never -180..214 'while ...; }; }': () -186..187 'n': i32 -186..191 'n < 3': bool -190..191 '3': i32 -192..214 '{ loop...; }; }': () -194..211 'loop {...k 3; }': i32 -199..211 '{ break 3; }': never -201..208 'break 3': never -207..208 '3': i32 diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__invalid_binary_ops.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__invalid_binary_ops.snap deleted file mode 100644 index 66e4b347b..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__invalid_binary_ops.snap +++ /dev/null @@ -1,13 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "fn foo() {\n let b = false;\n let n = 1;\n let _ = b + n; // error: invalid binary operation\n}" ---- -57..62: cannot apply binary operator -9..100 '{ ...tion }': () -19..20 'b': bool -23..28 'false': bool -38..39 'n': i32 -42..43 '1': i32 -57..58 'b': bool -57..62 'b + n': i32 -61..62 'n': i32 diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__invalid_unary_ops.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__invalid_unary_ops.snap deleted file mode 100644 index 957117dc9..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__invalid_unary_ops.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "fn bar(a: f64, b: bool) {\n a = !a; // mismatched type\n b = -b; // mismatched type\n}" ---- -35..36: cannot apply unary operator -66..67: cannot apply unary operator -7..8 'a': f64 -15..16 'b': bool -24..89 '{ ...type }': () -30..31 'a': f64 -30..36 'a = !a': () -34..36 '!a': {unknown} -35..36 'a': f64 -61..62 'b': bool -61..67 'b = -b': () -65..67 '-b': {unknown} -66..67 'b': bool diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__issue_354.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__issue_354.snap deleted file mode 100644 index 135d1b94f..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__issue_354.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "fn value() -> i64 { 6 }\n\npub fn main() {\n let t = 2;\n t = loop { break value(); };\n}" - ---- -18..23 '{ 6 }': i64 -20..21 '6': i64 -39..90 '{ ...; }; }': () -49..50 't': i64 -53..54 '2': i64 -60..61 't': i64 -60..87 't = lo...e(); }': () -64..87 'loop {...e(); }': i64 -69..87 '{ brea...e(); }': never -71..84 'break value()': never -77..82 'value': function value() -> i64 -77..84 'value()': i64 diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__place_expressions.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__place_expressions.snap deleted file mode 100644 index c5946b38b..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__place_expressions.snap +++ /dev/null @@ -1,13 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "fn foo(a:i32) {\n a += 3;\n 3 = 5; // error: invalid left hand side of expression\n}" ---- -32..33: invalid left hand side of expression -7..8 'a': i32 -14..87 '{ ...sion }': () -20..21 'a': i32 -20..26 'a += 3': () -25..26 '3': i32 -32..33 '3': i32 -32..37 '3 = 5': () -36..37 '5': i32 diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__primitives.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__primitives.snap deleted file mode 100644 index 1ad696124..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__primitives.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "fn unsigned_primitives(a: u8, b: u16, c: u32, d: u64, e: u128, f: usize, g: u32) -> u8 { a }\nfn signed_primitives(a: i8, b: i16, c: i32, d: i64, e: i128, f: isize, g: i32) -> i8 { a }\nfn float_primitives(a: f32, b: f64, c: f64) -> f32 { a }" ---- -23..24 'a': u8 -30..31 'b': u16 -38..39 'c': u32 -46..47 'd': u64 -54..55 'e': u128 -63..64 'f': usize -73..74 'g': u32 -87..92 '{ a }': u8 -89..90 'a': u8 -114..115 'a': i8 -121..122 'b': i16 -129..130 'c': i32 -137..138 'd': i64 -145..146 'e': i128 -154..155 'f': isize -164..165 'g': i32 -178..183 '{ a }': i8 -180..181 'a': i8 -204..205 'a': f32 -212..213 'b': f64 -220..221 'c': f64 -235..240 '{ a }': f32 -237..238 'a': f32 diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__private_access.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__private_access.snap deleted file mode 100644 index 699209488..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__private_access.snap +++ /dev/null @@ -1,107 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "//- /foo.mun\nstruct Foo {};\nstruct Bar(i64);\nstruct Baz;\nfn foo() {}\ntype FooBar = Foo;\n\npub struct PubFoo {};\npub struct PubBar(i64);\npub struct PubBaz;\npub fn pub_foo() {}\npub type PubFooBar = PubFoo;\n\npub(super) struct PubSupFoo {};\npub(super) struct PubSupBar(i64);\npub(super) struct PubSupBaz;\npub(super) fn pub_sup_foo() {}\npub(super) type PubSupFooBar = PubSupFoo;\n\npub(package) struct PubPackageFoo {};\npub(package) struct PubPackageBar(i64);\npub(package) struct PubPackageBaz;\npub(package) fn pub_package_foo() {}\npub(package) type PubPackageFooBar = PubPackageFoo;\n\n//- /bar.mun\nfn main() {\n let a = package::foo::Foo {}; // private access\n let a = package::foo::Bar(3); // private access\n let a = package::foo::Baz; // private access\n let a = package::foo::FooBar{}}; // private access\n\n let a = super::foo::Foo {}; // private access\n let a = super::foo::Bar(3); // private access\n let a = super::foo::Baz; // private access\n let a = super::foo::FooBar{}; // private access\n\n package::foo::foo(); // private access\n super::foo::foo(); // private access\n\n let a = package::foo::PubFoo {};\n let a = package::foo::PubBar(3);\n let a = package::foo::PubBaz;\n let a = package::foo::PubFooBar{};\n\n let a = super::foo::PubFoo {};\n let a = super::foo::PubBar(3);\n let a = super::foo::PubBaz;\n let a = super::foo::PubFooBar{};\n\n package::foo::pub_foo();\n super::foo::pub_foo();\n\n let a = package::foo::PubSupFoo {};\n let a = package::foo::PubSupBar(3);\n let a = package::foo::PubSupBaz;\n let a = package::foo::PubSupFooBar{};\n\n let a = super::foo::PubSupFoo {};\n let a = super::foo::PubSupBar(3);\n let a = super::foo::PubSupBaz;\n let a = super::foo::PubSupFooBar{};\n\n package::foo::pub_sup_foo();\n super::foo::pub_sup_foo();\n\n let a = package::foo::PubPackageFoo {};\n let a = package::foo::PubPackageBar(3);\n let a = package::foo::PubPackageBaz;\n let a = package::foo::PubPackageFooBar{};\n\n let a = super::foo::PubPackageFoo {};\n let a = super::foo::PubPackageBar(3);\n let a = super::foo::PubPackageBaz;\n let a = super::foo::PubPackageFooBar{};\n\n package::foo::pub_package_foo();\n super::foo::pub_package_foo();\n}\n\n//- /foo/baz.mun\nfn main() {\n let a = package::foo::Foo {};\n let a = package::foo::Bar(3);\n let a = package::foo::Baz;\n let a = package::foo::FooBar{};\n\n let a = super::Foo {};\n let a = super::Bar(3);\n let a = super::Baz;\n let a = super::FooBar{};\n\n package::foo::foo();\n super::foo();\n}\n\n//- /mod.mun\nfn main() {\n let a = package::foo::Foo {}; // private access\n let a = package::foo::Bar(3); // private access\n let a = package::foo::Baz; // private access\n let a = package::foo::FooBar{}; // private access\n\n let a = foo::Foo {}; // private access\n let a = foo::Bar(3); // private access\n let a = foo::Baz; // private access\n let a = foo::FooBar{}; // private access\n\n package::foo::foo(); // private access\n foo::foo(); // private access\n\n let a = package::foo::PubSupFoo {};\n let a = package::foo::PubSupBar(3);\n let a = package::foo::PubSupBaz;\n let a = package::foo::PubSupFooBar{};\n\n let a = foo::PubSupFoo {};\n let a = foo::PubSupBar(3);\n let a = foo::PubSupBaz;\n let a = foo::PubSupFooBar{};\n\n package::foo::pub_sup_foo();\n foo::pub_sup_foo();\n}" ---- -24..41: access of private type -76..93: access of private type -128..145: access of private type -177..197: access of private type -232..240: access of private type -275..283: access of private type -318..326: access of private type -358..369: access of private type -396..413: access of private type -439..447: access of private type -24..41: access of private type -76..93: access of private type -128..145: access of private type -177..197: access of private type -10..812 '{ ...o(); }': () -20..21 'a': Foo -24..44 'packag...Foo {}': Foo -72..73 'a': Bar -76..93 'packag...o::Bar': ctor Bar(i64) -> Bar -76..96 'packag...Bar(3)': Bar -94..95 '3': i64 -124..125 'a': Baz -128..145 'packag...o::Baz': Baz -173..174 'a': Foo -177..199 'packag...oBar{}': Foo -228..229 'a': Foo -232..243 'foo::Foo {}': Foo -271..272 'a': Bar -275..283 'foo::Bar': ctor Bar(i64) -> Bar -275..286 'foo::Bar(3)': Bar -284..285 '3': i64 -314..315 'a': Baz -318..326 'foo::Baz': Baz -354..355 'a': Foo -358..371 'foo::FooBar{}': Foo -396..413 'packag...o::foo': function foo() -> () -396..415 'packag...:foo()': () -439..447 'foo::foo': function foo() -> () -439..449 'foo::foo()': () -478..479 'a': PubSupFoo -482..508 'packag...Foo {}': PubSupFoo -518..519 'a': PubSupBar -522..545 'packag...SupBar': ctor PubSupBar(i64) -> PubSupBar -522..548 'packag...Bar(3)': PubSupBar -546..547 '3': i64 -558..559 'a': PubSupBaz -562..585 'packag...SupBaz': PubSupBaz -595..596 'a': PubSupFoo -599..627 'packag...oBar{}': PubSupFoo -638..639 'a': PubSupFoo -642..659 'foo::P...Foo {}': PubSupFoo -669..670 'a': PubSupBar -673..687 'foo::PubSupBar': ctor PubSupBar(i64) -> PubSupBar -673..690 'foo::P...Bar(3)': PubSupBar -688..689 '3': i64 -700..701 'a': PubSupBaz -704..718 'foo::PubSupBaz': PubSupBaz -728..729 'a': PubSupFoo -732..751 'foo::P...oBar{}': PubSupFoo -758..783 'packag...up_foo': function pub_sup_foo() -> () -758..785 'packag..._foo()': () -791..807 'foo::p...up_foo': function pub_sup_foo() -> () -791..809 'foo::p..._foo()': () -10..200 '{ ...Bar{}}': () -20..21 'a': Foo -24..44 'packag...Foo {}': Foo -72..73 'a': Bar -76..93 'packag...o::Bar': ctor Bar(i64) -> Bar -76..96 'packag...Bar(3)': Bar -94..95 '3': i64 -124..125 'a': Baz -128..145 'packag...o::Baz': Baz -173..174 'a': Foo -177..199 'packag...oBar{}': Foo -53..55 '{}': () -158..160 '{}': () -314..316 '{}': () -507..509 '{}': () -10..300 '{ ...o(); }': () -20..21 'a': Foo -24..44 'packag...Foo {}': Foo -54..55 'a': Bar -58..75 'packag...o::Bar': ctor Bar(i64) -> Bar -58..78 'packag...Bar(3)': Bar -76..77 '3': i64 -88..89 'a': Baz -92..109 'packag...o::Baz': Baz -119..120 'a': Foo -123..145 'packag...oBar{}': Foo -156..157 'a': Foo -160..173 'super::Foo {}': Foo -183..184 'a': Bar -187..197 'super::Bar': ctor Bar(i64) -> Bar -187..200 'super::Bar(3)': Bar -198..199 '3': i64 -210..211 'a': Baz -214..224 'super::Baz': Baz -234..235 'a': Foo -238..253 'super::FooBar{}': Foo -260..277 'packag...o::foo': function foo() -> () -260..279 'packag...:foo()': () -285..295 'super::foo': function foo() -> () -285..297 'super::foo()': () diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__recursive_alias.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__recursive_alias.snap deleted file mode 100644 index 7e0755652..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__recursive_alias.snap +++ /dev/null @@ -1,13 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "struct Foo {}\ntype Foo = Foo;\n\ntype A = B;\ntype B = A;\n\nfn main() {\n let a: Foo; // error: unknown type\n let b: A; // error: unknown type\n let c: B; // error: unknown type\n}" ---- -14..29: the name `Foo` is defined multiple times -40..41: cyclic type -52..53: cyclic type -119..120: cyclic type -159..160: cyclic type -66..189 '{ ...type }': () -76..77 'a': Foo -116..117 'b': {unknown} -156..157 'c': {unknown} diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__scoped_path.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__scoped_path.snap deleted file mode 100644 index b6f862b27..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__scoped_path.snap +++ /dev/null @@ -1,19 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "//- /mod.mun\nstruct Foo;\n\nfn main() -> self::Foo {\n Foo\n}\n\nfn bar() -> Foo {\n super::Foo // undefined value\n}\n\nfn baz() -> Foo {\n package::Foo\n}\n\n//- /foo.mun\nstruct Foo;\n\nfn bar() -> Foo {\n super::Foo // mismatched type\n}\n\nfn baz() -> package::Foo {\n super::Foo\n}\n\nfn nested() -> self::Foo {\n package::foo::Foo\n}" ---- -71..81: undefined value -35..45: mismatched type -29..67: mismatched type -36..47 '{ Foo }': Foo -42..45 'Foo': Foo -65..103 '{ ...alue }': Foo -71..81 'super::Foo': {unknown} -121..141 '{ ...:Foo }': Foo -127..139 'package::Foo': Foo -29..67 '{ ...type }': Foo -35..45 'super::Foo': Foo -94..112 '{ ...:Foo }': Foo -100..110 'super::Foo': Foo -139..164 '{ ...:Foo }': Foo -145..162 'packag...o::Foo': Foo diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__struct_decl.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__struct_decl.snap deleted file mode 100644 index 135630445..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__struct_decl.snap +++ /dev/null @@ -1,8 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "struct Foo;\nstruct(gc) Bar {\n f: f64,\n i: i32,\n}\nstruct(value) Baz(f64, i32);\n\n\nfn main() {\n let foo: Foo;\n let bar: Bar;\n let baz: Baz;\n}" ---- -96..153 '{ ...Baz; }': () -106..109 'foo': Foo -124..127 'bar': Bar -142..145 'baz': Baz diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__struct_field_index.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__struct_field_index.snap deleted file mode 100644 index 57dd1dbda..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__struct_field_index.snap +++ /dev/null @@ -1,38 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "struct Foo {\n a: f64,\n b: i32,\n}\nstruct Bar(f64, i32)\nstruct Baz;\n\nfn main() {\n let foo = Foo { a: 1.23, b: 4 };\n foo.a\n foo.b\n foo.c // error: attempted to access a non-existent field in a struct.\n let bar = Bar(1.23, 4);\n bar.0\n bar.1\n bar.2 // error: attempted to access a non-existent field in a struct.\n let baz = Baz;\n baz.a // error: attempted to access a non-existent field in a struct.\n let f = 1.0\n f.0; // error: attempted to access a field on a primitive type.\n}" ---- -146..151: attempted to access a non-existent field in a struct. -268..273: attempted to access a non-existent field in a struct. -361..366: attempted to access a non-existent field in a struct. -451..452: attempted to access a field on a primitive type. -83..516 '{ ...ype. }': () -93..96 'foo': Foo -99..120 'Foo { ...b: 4 }': Foo -108..112 '1.23': f64 -117..118 '4': i32 -126..129 'foo': Foo -126..131 'foo.a': f64 -136..139 'foo': Foo -136..141 'foo.b': i32 -146..149 'foo': Foo -146..151 'foo.c': {unknown} -224..227 'bar': Bar -230..233 'Bar': ctor Bar(f64, i32) -> Bar -230..242 'Bar(1.23, 4)': Bar -234..238 '1.23': f64 -240..241 '4': i32 -248..251 'bar': Bar -248..253 'bar.0': f64 -258..261 'bar': Bar -258..263 'bar.1': i32 -268..271 'bar': Bar -268..273 'bar.2': {unknown} -346..349 'baz': Baz -352..355 'Baz': Baz -361..364 'baz': Baz -361..366 'baz.a': {unknown} -439..440 'f': f64 -443..446 '1.0': f64 -451..452 'f': f64 -451..454 'f.0': {unknown} diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__struct_lit.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__struct_lit.snap deleted file mode 100644 index 49b49026e..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__struct_lit.snap +++ /dev/null @@ -1,44 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "struct Foo;\nstruct Bar {\n a: f64,\n}\nstruct Baz(f64, i32);\n\nfn main() {\n let a: Foo = Foo;\n let b: Bar = Bar { a: 1.23, };\n let c = Baz(1.23, 1);\n\n let a = Foo{}; // error: mismatched struct literal kind. expected `unit struct`, found `record`\n let a = Foo(); // error: mismatched struct literal kind. expected `unit struct`, found `tuple`\n let b = Bar; // error: mismatched struct literal kind. expected `record`, found `unit struct`\n let b = Bar(); // error: mismatched struct literal kind. expected `record`, found `tuple`\n let b = Bar{}; // error: missing record fields: a\n let c = Baz; // error: mismatched struct literal kind. expected `tuple`, found `unit struct`\n let c = Baz{}; // error: mismatched struct literal kind. expected `tuple`, found `record`\n let c = Baz(); // error: this tuple struct literal has 2 fields but 0 fields were supplied\n}" ---- -170..175: mismatched struct literal kind. expected `unit struct`, found `record` -270..275: mismatched struct literal kind. expected `unit struct`, found `tuple` -369..372: mismatched struct literal kind. expected `record`, found `unit struct` -467..470: mismatched struct literal kind. expected `record`, found `tuple` -561..566: missing record fields: -- a - -615..618: mismatched struct literal kind. expected `tuple`, found `unit struct` -712..717: mismatched struct literal kind. expected `tuple`, found `record` -806..811: this tuple struct literal has 2 fields but 0 fields were supplied -72..890 '{ ...lied }': () -82..83 'a': Foo -91..94 'Foo': Foo -104..105 'b': Bar -113..129 'Bar { ....23, }': Bar -122..126 '1.23': f64 -139..140 'c': Baz -143..146 'Baz': ctor Baz(f64, i32) -> Baz -143..155 'Baz(1.23, 1)': Baz -147..151 '1.23': f64 -153..154 '1': i32 -166..167 'a': Foo -170..175 'Foo{}': Foo -266..267 'a': Foo -270..273 'Foo': Foo -270..275 'Foo()': Foo -365..366 'b': Bar -369..372 'Bar': Bar -463..464 'b': Bar -467..470 'Bar': Bar -467..472 'Bar()': Bar -557..558 'b': Bar -561..566 'Bar{}': Bar -611..612 'c': ctor Baz(f64, i32) -> Baz -615..618 'Baz': ctor Baz(f64, i32) -> Baz -708..709 'c': Baz -712..717 'Baz{}': Baz -802..803 'c': Baz -806..809 'Baz': ctor Baz(f64, i32) -> Baz -806..811 'Baz()': Baz diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__update_operators.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__update_operators.snap deleted file mode 100644 index 86c811ad3..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__update_operators.snap +++ /dev/null @@ -1,45 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "fn foo(a:i32, b:f64) {\n a += 3;\n a -= 3;\n a *= 3;\n a /= 3;\n a %= 3;\n b += 3.0;\n b -= 3.0;\n b *= 3.0;\n b /= 3.0;\n b %= 3.0;\n a *= 3.0; // mismatched type\n b *= 3; // mismatched type\n}" ---- -162..165: mismatched type -195..196: mismatched type -7..8 'a': i32 -14..15 'b': f64 -21..218 '{ ...type }': () -27..28 'a': i32 -27..33 'a += 3': () -32..33 '3': i32 -39..40 'a': i32 -39..45 'a -= 3': () -44..45 '3': i32 -51..52 'a': i32 -51..57 'a *= 3': () -56..57 '3': i32 -63..64 'a': i32 -63..69 'a /= 3': () -68..69 '3': i32 -75..76 'a': i32 -75..81 'a %= 3': () -80..81 '3': i32 -87..88 'b': f64 -87..95 'b += 3.0': () -92..95 '3.0': f64 -101..102 'b': f64 -101..109 'b -= 3.0': () -106..109 '3.0': f64 -115..116 'b': f64 -115..123 'b *= 3.0': () -120..123 '3.0': f64 -129..130 'b': f64 -129..137 'b /= 3.0': () -134..137 '3.0': f64 -143..144 'b': f64 -143..151 'b %= 3.0': () -148..151 '3.0': f64 -157..158 'a': i32 -157..165 'a *= 3.0': () -162..165 '3.0': f64 -190..191 'b': f64 -190..196 'b *= 3': () -195..196 '3': i32 diff --git a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__void_return.snap b/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__void_return.snap deleted file mode 100644 index 2207ae77b..000000000 --- a/crates/mun_hir/src/ty/snapshots/mun_hir__ty__tests__void_return.snap +++ /dev/null @@ -1,12 +0,0 @@ ---- -source: crates/mun_hir/src/ty/tests.rs -expression: "fn bar() {\n let a = 3;\n}\nfn foo(a:i32) {\n let c = bar()\n}" ---- -9..27 '{ ...= 3; }': () -19..20 'a': i32 -23..24 '3': i32 -35..36 'a': i32 -42..63 '{ ...ar() }': () -52..53 'c': () -56..59 'bar': function bar() -> () -56..61 'bar()': () diff --git a/crates/mun_hir/src/ty/tests.rs b/crates/mun_hir/src/ty/tests.rs index 94cd26818..2e6fb5215 100644 --- a/crates/mun_hir/src/ty/tests.rs +++ b/crates/mun_hir/src/ty/tests.rs @@ -6,20 +6,33 @@ use std::{fmt::Write, sync::Arc}; #[test] fn issue_354() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" fn value() -> i64 { 6 } pub fn main() { let t = 2; t = loop { break value(); }; - }"#, - ) + }"#), + @r###" + 18..23 '{ 6 }': i64 + 20..21 '6': i64 + 39..90 '{ ...; }; }': () + 49..50 't': i64 + 53..54 '2': i64 + 60..61 't': i64 + 60..87 't = lo...e(); }': () + 64..87 'loop {...e(); }': i64 + 69..87 '{ brea...e(); }': never + 71..84 'break value()': never + 77..82 'value': function value() -> i64 + 77..84 'value()': i64 + "###); } #[test] fn private_access() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" //- /foo.mun struct Foo {}; @@ -145,13 +158,117 @@ fn private_access() { package::foo::pub_sup_foo(); foo::pub_sup_foo(); } - "#, - ) + "#), + @r###" + 24..41: access of private type + 76..93: access of private type + 128..145: access of private type + 177..197: access of private type + 232..240: access of private type + 275..283: access of private type + 318..326: access of private type + 358..369: access of private type + 396..413: access of private type + 439..447: access of private type + 24..41: access of private type + 76..93: access of private type + 128..145: access of private type + 177..197: access of private type + 10..812 '{ ...o(); }': () + 20..21 'a': Foo + 24..44 'packag...Foo {}': Foo + 72..73 'a': Bar + 76..93 'packag...o::Bar': ctor Bar(i64) -> Bar + 76..96 'packag...Bar(3)': Bar + 94..95 '3': i64 + 124..125 'a': Baz + 128..145 'packag...o::Baz': Baz + 173..174 'a': Foo + 177..199 'packag...oBar{}': Foo + 228..229 'a': Foo + 232..243 'foo::Foo {}': Foo + 271..272 'a': Bar + 275..283 'foo::Bar': ctor Bar(i64) -> Bar + 275..286 'foo::Bar(3)': Bar + 284..285 '3': i64 + 314..315 'a': Baz + 318..326 'foo::Baz': Baz + 354..355 'a': Foo + 358..371 'foo::FooBar{}': Foo + 396..413 'packag...o::foo': function foo() -> () + 396..415 'packag...:foo()': () + 439..447 'foo::foo': function foo() -> () + 439..449 'foo::foo()': () + 478..479 'a': PubSupFoo + 482..508 'packag...Foo {}': PubSupFoo + 518..519 'a': PubSupBar + 522..545 'packag...SupBar': ctor PubSupBar(i64) -> PubSupBar + 522..548 'packag...Bar(3)': PubSupBar + 546..547 '3': i64 + 558..559 'a': PubSupBaz + 562..585 'packag...SupBaz': PubSupBaz + 595..596 'a': PubSupFoo + 599..627 'packag...oBar{}': PubSupFoo + 638..639 'a': PubSupFoo + 642..659 'foo::P...Foo {}': PubSupFoo + 669..670 'a': PubSupBar + 673..687 'foo::PubSupBar': ctor PubSupBar(i64) -> PubSupBar + 673..690 'foo::P...Bar(3)': PubSupBar + 688..689 '3': i64 + 700..701 'a': PubSupBaz + 704..718 'foo::PubSupBaz': PubSupBaz + 728..729 'a': PubSupFoo + 732..751 'foo::P...oBar{}': PubSupFoo + 758..783 'packag...up_foo': function pub_sup_foo() -> () + 758..785 'packag..._foo()': () + 791..807 'foo::p...up_foo': function pub_sup_foo() -> () + 791..809 'foo::p..._foo()': () + 10..200 '{ ...Bar{}}': () + 20..21 'a': Foo + 24..44 'packag...Foo {}': Foo + 72..73 'a': Bar + 76..93 'packag...o::Bar': ctor Bar(i64) -> Bar + 76..96 'packag...Bar(3)': Bar + 94..95 '3': i64 + 124..125 'a': Baz + 128..145 'packag...o::Baz': Baz + 173..174 'a': Foo + 177..199 'packag...oBar{}': Foo + 53..55 '{}': () + 158..160 '{}': () + 314..316 '{}': () + 507..509 '{}': () + 10..300 '{ ...o(); }': () + 20..21 'a': Foo + 24..44 'packag...Foo {}': Foo + 54..55 'a': Bar + 58..75 'packag...o::Bar': ctor Bar(i64) -> Bar + 58..78 'packag...Bar(3)': Bar + 76..77 '3': i64 + 88..89 'a': Baz + 92..109 'packag...o::Baz': Baz + 119..120 'a': Foo + 123..145 'packag...oBar{}': Foo + 156..157 'a': Foo + 160..173 'super::Foo {}': Foo + 183..184 'a': Bar + 187..197 'super::Bar': ctor Bar(i64) -> Bar + 187..200 'super::Bar(3)': Bar + 198..199 '3': i64 + 210..211 'a': Baz + 214..224 'super::Baz': Baz + 234..235 'a': Foo + 238..253 'super::FooBar{}': Foo + 260..277 'packag...o::foo': function foo() -> () + 260..279 'packag...:foo()': () + 285..295 'super::foo': function foo() -> () + 285..297 'super::foo()': () + "###); } #[test] fn scoped_path() { - infer_snapshot( + insta::assert_snapshot!(infer( r" //- /mod.mun struct Foo; @@ -182,25 +299,47 @@ fn scoped_path() { fn nested() -> self::Foo { package::foo::Foo } - ", - ) + "), + @r###" + 71..81: undefined value + 35..45: mismatched type + 29..67: mismatched type + 36..47 '{ Foo }': Foo + 42..45 'Foo': Foo + 65..103 '{ ...alue }': Foo + 71..81 'super::Foo': {unknown} + 121..141 '{ ...:Foo }': Foo + 127..139 'package::Foo': Foo + 29..67 '{ ...type }': Foo + 35..45 'super::Foo': Foo + 94..112 '{ ...:Foo }': Foo + 100..110 'super::Foo': Foo + 139..164 '{ ...:Foo }': Foo + 145..162 'packag...o::Foo': Foo + "###); } #[test] fn comparison_not_implemented_for_struct() { - infer_snapshot( + insta::assert_snapshot!(infer( r" struct Foo; fn main() -> bool { Foo == Foo - }", - ) + }"), + @r###" + 37..47: cannot apply binary operator + 31..49 '{ ... Foo }': bool + 37..40 'Foo': Foo + 37..47 'Foo == Foo': bool + 44..47 'Foo': Foo + "###); } #[test] fn infer_literals() { - infer_snapshot( + insta::assert_snapshot!(infer( r" fn integer() -> i32 { 0 @@ -215,13 +354,24 @@ fn infer_literals() { let a = 4; a } - ", - ) + "), + @r###" + 20..29 '{ 0 }': i32 + 26..27 '0': i32 + 67..76 '{ 0 }': u128 + 73..74 '0': u128 + 99..138 '{ ... a }': u16 + 109..110 'b': i32 + 113..114 '4': i32 + 124..125 'a': u16 + 128..129 '4': u16 + 135..136 'a': u16 + "###); } #[test] fn infer_suffix_literals() { - infer_snapshot( + insta::assert_snapshot!(infer( r" fn main(){ 123; @@ -259,23 +409,74 @@ fn infer_suffix_literals() { 12712371237123_u32; // literal out of range `u32` 9999999999999999999999999; // literal out of range `i32` } - ", - ) + "), + @r###" + 358..365: invalid literal value + 390..401: binary float literal is not supported + 426..437: octal float literal is not supported + 462..470: invalid suffix `foo` + 494..504: invalid suffix `bar` + 528..571: int literal is too large + 590..596: literal out of range for `u8` + 635..641: literal out of range for `i8` + 680..698: literal out of range for `u32` + 734..759: literal out of range for `i32` + 9..298 '{ ...f64; }': () + 15..18 '123': i32 + 24..29 '123u8': u8 + 35..41 '123u16': u16 + 47..53 '123u32': u32 + 59..65 '123u64': u64 + 71..78 '123u128': u128 + 84..97 '1_000_000_u32': u32 + 103..108 '123i8': i8 + 114..120 '123i16': i16 + 126..132 '123i32': i32 + 138..144 '123i64': i64 + 150..157 '123i128': i128 + 163..176 '1_000_000_i32': i32 + 182..196 '1_000_123.0e-2': f64 + 202..219 '1_000_...e-2f32': f32 + 225..242 '1_000_...e-2f64': f64 + 248..295 '999999...99_f64': f64 + 307..308 'a': u32 + 321..338 '{ ...2u32 }': u32 + 327..328 'a': u32 + 327..336 'a + 12u32': u32 + 331..336 '12u32': u32 + 352..792 '{ ...i32` }': () + 358..365 '0b22222': i32 + 390..401 '0b00010_f32': f32 + 426..437 '0o71234_f32': f32 + 462..470 '1234_foo': i32 + 494..504 '1234.0_bar': f64 + 528..571 '999999...999999': i32 + 590..596 '256_u8': u8 + 635..641 '128_i8': i8 + 680..698 '127123...23_u32': u32 + 734..759 '999999...999999': i32 + "###); } #[test] fn infer_invalid_struct_type() { - infer_snapshot( + insta::assert_snapshot!(infer( r" fn main(){ let a = Foo {b: 3}; - }", - ) + }"), + @r###" + 23..26: undefined type + 9..36 '{ ... 3}; }': () + 19..20 'a': {unknown} + 23..33 'Foo {b: 3}': {unknown} + 31..32 '3': i32 + "###); } #[test] fn infer_conditional_return() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" fn foo(a:int)->i32 { if a > 4 { @@ -291,25 +492,55 @@ fn infer_conditional_return() { return 1; } } - "#, - ) + "#), + @r###" + 9..12: undefined type + 7..8 'a': {unknown} + 19..67 '{ ... a }': i32 + 25..59 'if a >... }': () + 28..29 'a': {unknown} + 28..33 'a > 4': bool + 32..33 '4': i32 + 34..59 '{ ... }': never + 44..52 'return 4': never + 51..52 '4': i32 + 64..65 'a': {unknown} + 76..77 'a': i32 + 88..161 '{ ... } }': i32 + 94..159 'if a >... }': i32 + 97..98 'a': i32 + 97..102 'a > 4': bool + 101..102 '4': i32 + 103..128 '{ ... }': never + 113..121 'return 4': never + 120..121 '4': i32 + 134..159 '{ ... }': never + 144..152 'return 1': never + 151..152 '1': i32 + "###); } #[test] fn infer_return() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" fn test()->i32 { return; // error: mismatched type return 5; } - "#, - ) + "#), + @r###" + 21..27: `return;` in a function whose return type is not `()` + 15..70 '{ ...n 5; }': never + 21..27 'return': never + 59..67 'return 5': never + 66..67 '5': i32 + "###); } #[test] fn infer_basics() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" fn test(a:i32, b:f64, c:never, d:bool) -> bool { a; @@ -317,13 +548,23 @@ fn infer_basics() { c; d } - "#, - ) + "#), + @r###" + 8..9 'a': i32 + 15..16 'b': f64 + 22..23 'c': never + 31..32 'd': bool + 47..77 '{ ... d }': never + 53..54 'a': i32 + 60..61 'b': f64 + 67..68 'c': never + 74..75 'd': bool + "###); } #[test] fn infer_branching() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" fn test() { let a = if true { 3 } else { 4 } @@ -332,13 +573,52 @@ fn infer_branching() { let d = if true { 5 } else if false { 3 } else { 4 } let e = if true { 5.0 } else { 5 } // Mismatched branches } - "#, - ) + "#), + @r###" + 61..74: missing else branch + 208..234: mismatched branches + 10..260 '{ ...ches }': () + 20..21 'a': i32 + 24..48 'if tru... { 4 }': i32 + 27..31 'true': bool + 32..37 '{ 3 }': i32 + 34..35 '3': i32 + 43..48 '{ 4 }': i32 + 45..46 '4': i32 + 57..58 'b': () + 61..74 'if true { 3 }': () + 64..68 'true': bool + 69..74 '{ 3 }': i32 + 71..72 '3': i32 + 120..121 'c': () + 124..138 'if true { 3; }': () + 127..131 'true': bool + 132..138 '{ 3; }': () + 134..135 '3': i32 + 147..148 'd': i32 + 151..195 'if tru... { 4 }': i32 + 154..158 'true': bool + 159..164 '{ 5 }': i32 + 161..162 '5': i32 + 170..195 'if fal... { 4 }': i32 + 173..178 'false': bool + 179..184 '{ 3 }': i32 + 181..182 '3': i32 + 190..195 '{ 4 }': i32 + 192..193 '4': i32 + 204..205 'e': f64 + 208..234 'if tru... { 5 }': f64 + 211..215 'true': bool + 216..223 '{ 5.0 }': f64 + 218..221 '5.0': f64 + 229..234 '{ 5 }': i32 + 231..232 '5': i32 + "###); } #[test] fn void_return() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" fn bar() { let a = 3; @@ -346,25 +626,44 @@ fn void_return() { fn foo(a:i32) { let c = bar() } - "#, - ) + "#), + @r###" + 9..27 '{ ...= 3; }': () + 19..20 'a': i32 + 23..24 '3': i32 + 35..36 'a': i32 + 42..63 '{ ...ar() }': () + 52..53 'c': () + 56..59 'bar': function bar() -> () + 56..61 'bar()': () + "###); } #[test] fn place_expressions() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" fn foo(a:i32) { a += 3; 3 = 5; // error: invalid left hand side of expression } - "#, - ) + "#), + @r###" + 32..33: invalid left hand side of expression + 7..8 'a': i32 + 14..87 '{ ...sion }': () + 20..21 'a': i32 + 20..26 'a += 3': () + 25..26 '3': i32 + 32..33 '3': i32 + 32..37 '3 = 5': () + 36..37 '5': i32 + "###); } #[test] fn update_operators() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" fn foo(a:i32, b:f64) { a += 3; @@ -380,48 +679,120 @@ fn update_operators() { a *= 3.0; // mismatched type b *= 3; // mismatched type } - "#, - ) + "#), + @r###" + 162..165: mismatched type + 195..196: mismatched type + 7..8 'a': i32 + 14..15 'b': f64 + 21..218 '{ ...type }': () + 27..28 'a': i32 + 27..33 'a += 3': () + 32..33 '3': i32 + 39..40 'a': i32 + 39..45 'a -= 3': () + 44..45 '3': i32 + 51..52 'a': i32 + 51..57 'a *= 3': () + 56..57 '3': i32 + 63..64 'a': i32 + 63..69 'a /= 3': () + 68..69 '3': i32 + 75..76 'a': i32 + 75..81 'a %= 3': () + 80..81 '3': i32 + 87..88 'b': f64 + 87..95 'b += 3.0': () + 92..95 '3.0': f64 + 101..102 'b': f64 + 101..109 'b -= 3.0': () + 106..109 '3.0': f64 + 115..116 'b': f64 + 115..123 'b *= 3.0': () + 120..123 '3.0': f64 + 129..130 'b': f64 + 129..137 'b /= 3.0': () + 134..137 '3.0': f64 + 143..144 'b': f64 + 143..151 'b %= 3.0': () + 148..151 '3.0': f64 + 157..158 'a': i32 + 157..165 'a *= 3.0': () + 162..165 '3.0': f64 + 190..191 'b': f64 + 190..196 'b *= 3': () + 195..196 '3': i32 + "###); } #[test] fn infer_unary_ops() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" fn foo(a: i32, b: bool) { a = -a; b = !b; } - "#, - ) + "#), + @r###" + 7..8 'a': i32 + 15..16 'b': bool + 24..51 '{ ... !b; }': () + 30..31 'a': i32 + 30..36 'a = -a': () + 34..36 '-a': i32 + 35..36 'a': i32 + 42..43 'b': bool + 42..48 'b = !b': () + 46..48 '!b': bool + 47..48 'b': bool + "###); } #[test] fn invalid_unary_ops() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" fn bar(a: f64, b: bool) { a = !a; // mismatched type b = -b; // mismatched type } - "#, - ) + "#), + @r###" + 35..36: cannot apply unary operator + 66..67: cannot apply unary operator + 7..8 'a': f64 + 15..16 'b': bool + 24..89 '{ ...type }': () + 30..31 'a': f64 + 30..36 'a = !a': () + 34..36 '!a': {unknown} + 35..36 'a': f64 + 61..62 'b': bool + 61..67 'b = -b': () + 65..67 '-b': {unknown} + 66..67 'b': bool + "###); } #[test] fn infer_loop() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" fn foo() { loop {} } - "#, - ) + "#), + @r###" + 9..24 '{ loop {} }': never + 15..22 'loop {}': never + 20..22 '{}': () + "###); } #[test] fn infer_break() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" fn foo()->i32 { break; // error: not in a loop @@ -431,13 +802,50 @@ fn infer_break() { let a:i32 = loop { break loop { break 3; } } loop { break loop { break 3.0; } } // error: mismatched type } - "#, - ) + "#), + @r###" + 20..25: `break` outside of a loop + 71..80: mismatched type + 133..142: mismatched type + 267..276: mismatched type + 14..309 '{ ...type }': never + 20..25 'break': never + 55..83 'loop {...3.0; }': i32 + 60..83 '{ brea...3.0; }': never + 62..69 'break 3': never + 68..69 '3': i32 + 71..80 'break 3.0': never + 77..80 '3.0': f64 + 118..119 'a': i32 + 126..145 'loop {...3.0; }': i32 + 131..145 '{ break 3.0; }': never + 133..142 'break 3.0': never + 139..142 '3.0': f64 + 176..193 'loop {...k 3; }': i32 + 181..193 '{ break 3; }': never + 183..190 'break 3': never + 189..190 '3': i32 + 202..203 'a': i32 + 210..242 'loop {...3; } }': i32 + 215..242 '{ brea...3; } }': never + 217..240 'break ...k 3; }': never + 223..240 'loop {...k 3; }': i32 + 228..240 '{ break 3; }': never + 230..237 'break 3': never + 236..237 '3': i32 + 247..281 'loop {...0; } }': i32 + 252..281 '{ brea...0; } }': never + 254..279 'break ...3.0; }': never + 260..279 'loop {...3.0; }': i32 + 265..279 '{ break 3.0; }': never + 267..276 'break 3.0': never + 273..276 '3.0': f64 + "###); } #[test] fn infer_while() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" fn foo() { let n = 0; @@ -446,26 +854,73 @@ fn infer_while() { while n < 3 { break 3; }; // error: break with value can only appear in a loop while n < 3 { loop { break 3; }; }; } - "#, - ) + "#), + @r###" + 109..116: `break` with value can only appear in a `loop` + 9..217 '{ ...; }; }': () + 19..20 'n': i32 + 23..24 '0': i32 + 30..53 'while ...= 1; }': () + 36..37 'n': i32 + 36..41 'n < 3': bool + 40..41 '3': i32 + 42..53 '{ n += 1; }': () + 44..45 'n': i32 + 44..50 'n += 1': () + 49..50 '1': i32 + 59..89 'while ...eak; }': () + 65..66 'n': i32 + 65..70 'n < 3': bool + 69..70 '3': i32 + 71..89 '{ n +=...eak; }': never + 73..74 'n': i32 + 73..79 'n += 1': () + 78..79 '1': i32 + 81..86 'break': never + 95..119 'while ...k 3; }': () + 101..102 'n': i32 + 101..106 'n < 3': bool + 105..106 '3': i32 + 107..119 '{ break 3; }': never + 109..116 'break 3': never + 180..214 'while ...; }; }': () + 186..187 'n': i32 + 186..191 'n < 3': bool + 190..191 '3': i32 + 192..214 '{ loop...; }; }': () + 194..211 'loop {...k 3; }': i32 + 199..211 '{ break 3; }': never + 201..208 'break 3': never + 207..208 '3': i32 + "###); } #[test] fn invalid_binary_ops() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" fn foo() { let b = false; let n = 1; let _ = b + n; // error: invalid binary operation } - "#, - ) + "#), + @r###" + 57..62: cannot apply binary operator + 9..100 '{ ...tion }': () + 19..20 'b': bool + 23..28 'false': bool + 38..39 'n': i32 + 42..43 '1': i32 + 57..58 'b': bool + 57..62 'b + n': i32 + 61..62 'n': i32 + "###); } #[test] fn struct_decl() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" struct Foo; struct(gc) Bar { @@ -480,13 +935,18 @@ fn struct_decl() { let bar: Bar; let baz: Baz; } - "#, - ) + "#), + @r###" + 96..153 '{ ...Baz; }': () + 106..109 'foo': Foo + 124..127 'bar': Bar + 142..145 'baz': Baz + "###); } #[test] fn struct_lit() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" struct Foo; struct Bar { @@ -508,13 +968,54 @@ fn struct_lit() { let c = Baz{}; // error: mismatched struct literal kind. expected `tuple`, found `record` let c = Baz(); // error: this tuple struct literal has 2 fields but 0 fields were supplied } - "#, - ) + "#), + @r###" + 170..175: mismatched struct literal kind. expected `unit struct`, found `record` + 270..275: mismatched struct literal kind. expected `unit struct`, found `tuple` + 369..372: mismatched struct literal kind. expected `record`, found `unit struct` + 467..470: mismatched struct literal kind. expected `record`, found `tuple` + 561..566: missing record fields: + - a + + 615..618: mismatched struct literal kind. expected `tuple`, found `unit struct` + 712..717: mismatched struct literal kind. expected `tuple`, found `record` + 806..811: this tuple struct literal has 2 fields but 0 fields were supplied + 72..890 '{ ...lied }': () + 82..83 'a': Foo + 91..94 'Foo': Foo + 104..105 'b': Bar + 113..129 'Bar { ....23, }': Bar + 122..126 '1.23': f64 + 139..140 'c': Baz + 143..146 'Baz': ctor Baz(f64, i32) -> Baz + 143..155 'Baz(1.23, 1)': Baz + 147..151 '1.23': f64 + 153..154 '1': i32 + 166..167 'a': Foo + 170..175 'Foo{}': Foo + 266..267 'a': Foo + 270..273 'Foo': Foo + 270..275 'Foo()': Foo + 365..366 'b': Bar + 369..372 'Bar': Bar + 463..464 'b': Bar + 467..470 'Bar': Bar + 467..472 'Bar()': Bar + 557..558 'b': Bar + 561..566 'Bar{}': Bar + 611..612 'c': ctor Baz(f64, i32) -> Baz + 615..618 'Baz': ctor Baz(f64, i32) -> Baz + 708..709 'c': Baz + 712..717 'Baz{}': Baz + 802..803 'c': Baz + 806..809 'Baz': ctor Baz(f64, i32) -> Baz + 806..811 'Baz()': Baz + "###); } #[test] fn struct_field_index() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" struct Foo { a: f64, @@ -537,24 +1038,83 @@ fn struct_field_index() { let f = 1.0 f.0; // error: attempted to access a field on a primitive type. } - "#, - ) + "#), + @r###" + 146..151: attempted to access a non-existent field in a struct. + 268..273: attempted to access a non-existent field in a struct. + 361..366: attempted to access a non-existent field in a struct. + 451..452: attempted to access a field on a primitive type. + 83..516 '{ ...ype. }': () + 93..96 'foo': Foo + 99..120 'Foo { ...b: 4 }': Foo + 108..112 '1.23': f64 + 117..118 '4': i32 + 126..129 'foo': Foo + 126..131 'foo.a': f64 + 136..139 'foo': Foo + 136..141 'foo.b': i32 + 146..149 'foo': Foo + 146..151 'foo.c': {unknown} + 224..227 'bar': Bar + 230..233 'Bar': ctor Bar(f64, i32) -> Bar + 230..242 'Bar(1.23, 4)': Bar + 234..238 '1.23': f64 + 240..241 '4': i32 + 248..251 'bar': Bar + 248..253 'bar.0': f64 + 258..261 'bar': Bar + 258..263 'bar.1': i32 + 268..271 'bar': Bar + 268..273 'bar.2': {unknown} + 346..349 'baz': Baz + 352..355 'Baz': Baz + 361..364 'baz': Baz + 361..366 'baz.a': {unknown} + 439..440 'f': f64 + 443..446 '1.0': f64 + 451..452 'f': f64 + 451..454 'f.0': {unknown} + "###); } #[test] fn primitives() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" fn unsigned_primitives(a: u8, b: u16, c: u32, d: u64, e: u128, f: usize, g: u32) -> u8 { a } fn signed_primitives(a: i8, b: i16, c: i32, d: i64, e: i128, f: isize, g: i32) -> i8 { a } fn float_primitives(a: f32, b: f64, c: f64) -> f32 { a } - "#, - ) + "#), + @r###" + 23..24 'a': u8 + 30..31 'b': u16 + 38..39 'c': u32 + 46..47 'd': u64 + 54..55 'e': u128 + 63..64 'f': usize + 73..74 'g': u32 + 87..92 '{ a }': u8 + 89..90 'a': u8 + 114..115 'a': i8 + 121..122 'b': i16 + 129..130 'c': i32 + 137..138 'd': i64 + 145..146 'e': i128 + 154..155 'f': isize + 164..165 'g': i32 + 178..183 '{ a }': i8 + 180..181 'a': i8 + 204..205 'a': f32 + 212..213 'b': f64 + 220..221 'c': f64 + 235..240 '{ a }': f32 + 237..238 'a': f32 + "###); } #[test] fn extern_fn() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" extern fn foo(a:i32, b:i32) -> i32; fn main() { @@ -566,13 +1126,26 @@ fn extern_fn() { struct S; extern fn with_non_primitive(s:S); // extern functions can only have primitives as parameters extern fn with_non_primitive_return() -> S; // extern functions can only have primitives as parameters - "#, - ) + "#), + @r###" + 65..89: extern functions cannot have bodies + 174..175: extern functions can only have primitives as parameter- and return types + 279..280: extern functions can only have primitives as parameter- and return types + 14..15 'a': i32 + 21..22 'b': i32 + 46..63 '{ ...,4); }': () + 52..55 'foo': function foo(i32, i32) -> i32 + 52..60 'foo(3,4)': i32 + 56..57 '3': i32 + 58..59 '4': i32 + 87..89 '{}': () + 172..173 's': S + "###); } #[test] fn infer_type_alias() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" type Foo = i32; type Bar = Foo; @@ -581,13 +1154,19 @@ fn infer_type_alias() { fn main(a: Foo) { let b: Bar = a; } - "#, - ) + "#), + @r###" + 43..54: undefined type + 91..92 'a': i32 + 99..122 '{ ...= a; }': () + 109..110 'b': i32 + 118..119 'a': i32 + "###); } #[test] fn recursive_alias() { - infer_snapshot( + insta::assert_snapshot!(infer( r#" struct Foo {} type Foo = Foo; @@ -600,13 +1179,18 @@ fn recursive_alias() { let b: A; // error: unknown type let c: B; // error: unknown type } - "#, - ) -} - -fn infer_snapshot(text: &str) { - let text = text.trim().replace("\n ", "\n"); - insta::assert_snapshot!(insta::_macro_support::AutoName, infer(&text), &text); + "#), + @r###" + 14..29: the name `Foo` is defined multiple times + 40..41: cyclic type + 52..53: cyclic type + 119..120: cyclic type + 159..160: cyclic type + 66..189 '{ ...type }': () + 76..77 'a': Foo + 116..117 'b': {unknown} + 156..157 'c': {unknown} + "###); } fn infer(content: &str) -> String { diff --git a/crates/mun_hir/src/utils.rs b/crates/mun_hir/src/utils.rs index 0ba8b6293..a7c1942e9 100644 --- a/crates/mun_hir/src/utils.rs +++ b/crates/mun_hir/src/utils.rs @@ -11,8 +11,6 @@ pub(crate) fn make_mut_slice(a: &mut Arc<[T]>) -> &mut [T] { #[cfg(test)] pub mod tests { - use std::fmt::Write; - use crate::{ code_model::r#struct::validator::StructValidator, diagnostics::DiagnosticSink, @@ -25,10 +23,10 @@ pub mod tests { pub fn diagnostics(content: &str) -> String { let (db, _file_id) = MockDatabase::with_single_file(content); - let mut diags = String::new(); + let mut diags = Vec::new(); let mut diag_sink = DiagnosticSink::new(|diag| { - writeln!(diags, "{:?}: {}", diag.highlight_range(), diag.message()).unwrap(); + diags.push(format!("{:?}: {}", diag.highlight_range(), diag.message())); }); for item in Package::all(&db) @@ -52,6 +50,6 @@ pub mod tests { } drop(diag_sink); - diags + diags.join("\n") } } diff --git a/crates/mun_language_server/Cargo.toml b/crates/mun_language_server/Cargo.toml index 7e481a771..4f0035bae 100644 --- a/crates/mun_language_server/Cargo.toml +++ b/crates/mun_language_server/Cargo.toml @@ -38,5 +38,5 @@ ra_ap_text_edit="0.0.35" [dev-dependencies] tempdir = "0.3.7" mun_test = { path = "../mun_test"} -insta = "1.7.1" +insta = "1.12.0" itertools = "0.10.0" diff --git a/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__dot__tests__incomplete_struct.snap b/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__dot__tests__incomplete_struct.snap index f1ebbfc82..32d82998c 100644 --- a/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__dot__tests__incomplete_struct.snap +++ b/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__dot__tests__incomplete_struct.snap @@ -1,5 +1,7 @@ --- source: crates/mun_language_server/src/completion/dot.rs +assertion_line: 81 expression: "completion_string(r#\"\n struct Foo { bar: i32 }\n \n fn foo() {\n let bar = Foo;\n bar.$0\n }\n \"#,\n Some(CompletionKind::Reference))" + --- fd bar i32 diff --git a/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__dot__tests__nested_struct.snap b/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__dot__tests__nested_struct.snap index f34a7b08f..8a3283805 100644 --- a/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__dot__tests__nested_struct.snap +++ b/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__dot__tests__nested_struct.snap @@ -1,5 +1,7 @@ --- source: crates/mun_language_server/src/completion/dot.rs +assertion_line: 65 expression: "completion_string(r#\"\n struct Foo { baz: i32 }\n struct Bar(Foo)\n \n fn foo() {\n let bar = Bar(Foo{baz:0});\n bar.0.$0\n }\n \"#,\n Some(CompletionKind::Reference))" + --- fd baz i32 diff --git a/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__dot__tests__struct_fields.snap b/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__dot__tests__struct_fields.snap index 902967b3e..a85ee6ef0 100644 --- a/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__dot__tests__struct_fields.snap +++ b/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__dot__tests__struct_fields.snap @@ -1,6 +1,8 @@ --- source: crates/mun_language_server/src/completion/dot.rs +assertion_line: 32 expression: "completion_string(r#\"\n struct FooBar {\n foo: i32,\n bar: i32,\n };\n \n fn foo() {\n let bar = FooBar { foo: 0, bar: 0 };\n bar.$0\n }\n \"#,\n Some(CompletionKind::Reference))" + --- fd foo i32 fd bar i32 diff --git a/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__dot__tests__tuple_struct.snap b/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__dot__tests__tuple_struct.snap index 248b2dd3c..a8b1f310e 100644 --- a/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__dot__tests__tuple_struct.snap +++ b/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__dot__tests__tuple_struct.snap @@ -1,6 +1,8 @@ --- source: crates/mun_language_server/src/completion/dot.rs +assertion_line: 50 expression: "completion_string(r#\"\n struct FooBar(i32, i32)\n \n fn foo() {\n let bar = FooBar(0,0);\n bar.$0\n }\n \"#,\n Some(CompletionKind::Reference))" + --- fd 0 i32 fd 1 i32 diff --git a/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__unqualified_path__tests__local_scope.snap b/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__unqualified_path__tests__local_scope.snap index 6f4c0693c..5bb35330f 100644 --- a/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__unqualified_path__tests__local_scope.snap +++ b/crates/mun_language_server/src/completion/snapshots/mun_language_server__completion__unqualified_path__tests__local_scope.snap @@ -1,6 +1,8 @@ --- source: crates/mun_language_server/src/completion/unqualified_path.rs +assertion_line: 29 expression: "completion_string(r#\"\n fn foo() {\n let bar = 0;\n let foo_bar = 0;\n f$0\n }\n \"#,\n Some(CompletionKind::Reference))" + --- lc foo_bar i32 lc bar i32 diff --git a/crates/mun_language_server/tests/snapshots/initialization__document_symbols.snap b/crates/mun_language_server/tests/snapshots/initialization__document_symbols.snap index 591a18382..f0d556e99 100644 --- a/crates/mun_language_server/tests/snapshots/initialization__document_symbols.snap +++ b/crates/mun_language_server/tests/snapshots/initialization__document_symbols.snap @@ -1,6 +1,8 @@ --- source: crates/mun_language_server/tests/initialization.rs +assertion_line: 50 expression: symbols + --- Some( Nested( diff --git a/crates/mun_syntax/Cargo.toml b/crates/mun_syntax/Cargo.toml index a0383b3cd..86ab1acb4 100644 --- a/crates/mun_syntax/Cargo.toml +++ b/crates/mun_syntax/Cargo.toml @@ -23,4 +23,4 @@ ra_ap_text_edit = "0.0.35" itertools = "0.10.0" [dev-dependencies] -insta = "1.7.1" +insta = "1.12.0" diff --git a/crates/mun_syntax/src/tests/lexer.rs b/crates/mun_syntax/src/tests/lexer.rs index d5fae8d54..d1b22095f 100644 --- a/crates/mun_syntax/src/tests/lexer.rs +++ b/crates/mun_syntax/src/tests/lexer.rs @@ -13,19 +13,14 @@ fn dump_tokens(tokens: &[crate::Token], text: &str) -> String { acc } -fn lex_snapshot(text: &str) { - let text = text.trim().replace("\n ", "\n"); +fn dump_text_tokens(text: &str) -> String { let tokens = crate::tokenize(&text); - insta::assert_snapshot!( - insta::_macro_support::AutoName, - dump_tokens(&tokens, &text), - &text - ); + dump_tokens(&tokens, text) } #[test] fn numbers() { - lex_snapshot( + insta::assert_snapshot!(dump_text_tokens( r#" 1.34 0x3Af @@ -33,13 +28,27 @@ fn numbers() { 100_000 0x3a_u32 1f32 - 0o71234"#, - ) + 0o71234"#), @r###" + WHITESPACE 5 "\n " + FLOAT_NUMBER 4 "1.34" + WHITESPACE 5 "\n " + INT_NUMBER 5 "0x3Af" + WHITESPACE 5 "\n " + FLOAT_NUMBER 4 "1e-3" + WHITESPACE 5 "\n " + INT_NUMBER 7 "100_000" + WHITESPACE 5 "\n " + INT_NUMBER 8 "0x3a_u32" + WHITESPACE 5 "\n " + INT_NUMBER 4 "1f32" + WHITESPACE 5 "\n " + INT_NUMBER 7 "0o71234" + "###); } #[test] fn comments() { - lex_snapshot( + insta::assert_snapshot!(dump_text_tokens( r#" // hello, world! /**/ @@ -48,33 +57,78 @@ fn comments() { line comment */ /* /* nested */ */ - /* unclosed comment"#, - ) + /* unclosed comment"#), @r###" + WHITESPACE 5 "\n " + COMMENT 16 "// hello, world!" + WHITESPACE 5 "\n " + COMMENT 4 "/**/" + WHITESPACE 5 "\n " + COMMENT 19 "/* block comment */" + WHITESPACE 5 "\n " + COMMENT 38 "/* multi\n line\n comment */" + WHITESPACE 5 "\n " + COMMENT 18 "/* /* nested */ */" + WHITESPACE 5 "\n " + COMMENT 19 "/* unclosed comment" + "###); } #[test] fn whitespace() { - lex_snapshot( + insta::assert_snapshot!(dump_text_tokens( r#" h e ll o w - o r l d"#, - ) + o r l d"#), @r###" + WHITESPACE 5 "\n " + IDENT 1 "h" + WHITESPACE 1 " " + IDENT 1 "e" + WHITESPACE 1 " " + IDENT 2 "ll" + WHITESPACE 2 " " + IDENT 1 "o" + WHITESPACE 5 "\n " + IDENT 1 "w" + WHITESPACE 6 "\n\n " + IDENT 1 "o" + WHITESPACE 1 " " + IDENT 1 "r" + WHITESPACE 5 " " + IDENT 1 "l" + WHITESPACE 3 " " + IDENT 1 "d" + "###); } #[test] fn ident() { - lex_snapshot( + insta::assert_snapshot!(dump_text_tokens( r#" hello world_ _a2 _ __ x 即可编著课程 - "#, - ) + "#), @r###" + WHITESPACE 5 "\n " + IDENT 5 "hello" + WHITESPACE 1 " " + IDENT 6 "world_" + WHITESPACE 1 " " + IDENT 3 "_a2" + WHITESPACE 1 " " + UNDERSCORE 1 "_" + WHITESPACE 1 " " + IDENT 2 "__" + WHITESPACE 1 " " + IDENT 1 "x" + WHITESPACE 1 " " + IDENT 18 "即可编著课程" + WHITESPACE 5 "\n " + "###); } #[test] fn symbols() { - lex_snapshot( + insta::assert_snapshot!(dump_text_tokens( r#" # ( ) { } [ ] ; , = == @@ -94,13 +148,131 @@ fn symbols() { ^ ^= : :: -> - "#, - ) + "#), @r###" + WHITESPACE 5 "\n " + HASH 1 "#" + WHITESPACE 1 " " + L_PAREN 1 "(" + WHITESPACE 1 " " + R_PAREN 1 ")" + WHITESPACE 1 " " + L_CURLY 1 "{" + WHITESPACE 1 " " + R_CURLY 1 "}" + WHITESPACE 1 " " + L_BRACKET 1 "[" + WHITESPACE 1 " " + R_BRACKET 1 "]" + WHITESPACE 1 " " + SEMI 1 ";" + WHITESPACE 1 " " + COMMA 1 "," + WHITESPACE 5 "\n " + EQ 1 "=" + WHITESPACE 1 " " + EQ 1 "=" + EQ 1 "=" + WHITESPACE 5 "\n " + EXCLAMATION 1 "!" + EQ 1 "=" + WHITESPACE 5 "\n " + LT 1 "<" + WHITESPACE 1 " " + LT 1 "<" + EQ 1 "=" + WHITESPACE 5 "\n " + GT 1 ">" + WHITESPACE 1 " " + GT 1 ">" + EQ 1 "=" + WHITESPACE 5 "\n " + DOT 1 "." + WHITESPACE 1 " " + DOT 1 "." + DOT 1 "." + WHITESPACE 1 " " + DOT 1 "." + DOT 1 "." + DOT 1 "." + WHITESPACE 1 " " + DOT 1 "." + DOT 1 "." + EQ 1 "=" + WHITESPACE 5 "\n " + PLUS 1 "+" + WHITESPACE 1 " " + PLUS 1 "+" + EQ 1 "=" + WHITESPACE 5 "\n " + MINUS 1 "-" + WHITESPACE 1 " " + MINUS 1 "-" + EQ 1 "=" + WHITESPACE 5 "\n " + STAR 1 "*" + WHITESPACE 1 " " + STAR 1 "*" + EQ 1 "=" + WHITESPACE 5 "\n " + SLASH 1 "/" + WHITESPACE 1 " " + SLASH 1 "/" + EQ 1 "=" + WHITESPACE 5 "\n " + PERCENT 1 "%" + WHITESPACE 1 " " + PERCENT 1 "%" + EQ 1 "=" + WHITESPACE 5 "\n " + LT 1 "<" + LT 1 "<" + WHITESPACE 1 " " + LT 1 "<" + LT 1 "<" + EQ 1 "=" + WHITESPACE 5 "\n " + GT 1 ">" + GT 1 ">" + WHITESPACE 1 " " + GT 1 ">" + GT 1 ">" + EQ 1 "=" + WHITESPACE 5 "\n " + AMP 1 "&" + AMP 1 "&" + WHITESPACE 1 " " + AMP 1 "&" + WHITESPACE 1 " " + AMP 1 "&" + EQ 1 "=" + WHITESPACE 5 "\n " + PIPE 1 "|" + PIPE 1 "|" + WHITESPACE 1 " " + PIPE 1 "|" + WHITESPACE 1 " " + PIPE 1 "|" + EQ 1 "=" + WHITESPACE 5 "\n " + CARET 1 "^" + WHITESPACE 1 " " + CARET 1 "^" + EQ 1 "=" + WHITESPACE 5 "\n " + COLON 1 ":" + WHITESPACE 1 " " + COLON 1 ":" + COLON 1 ":" + WHITESPACE 5 "\n " + MINUS 1 "-" + GT 1 ">" + WHITESPACE 5 "\n " + "###); } #[test] fn strings() { - lex_snapshot( + insta::assert_snapshot!(dump_text_tokens( r#" "Hello, world!" 'Hello, world!' @@ -108,38 +280,123 @@ fn strings() { "\"\\" "multi line" - "#, - ) + "#), @r###" + WHITESPACE 5 "\n " + STRING 15 "\"Hello, world!\"" + WHITESPACE 5 "\n " + STRING 15 "'Hello, world!'" + WHITESPACE 5 "\n " + STRING 4 "\"\\n\"" + WHITESPACE 5 "\n " + STRING 6 "\"\\\"\\\\\"" + WHITESPACE 5 "\n " + STRING 16 "\"multi\n line\"" + WHITESPACE 5 "\n " + "###); } #[test] fn keywords() { - lex_snapshot( + insta::assert_snapshot!(dump_text_tokens( r#" break do else false for fn if in nil return true while let mut struct class never loop pub super self package type - "#, - ) + "#), @r###" + WHITESPACE 5 "\n " + BREAK_KW 5 "break" + WHITESPACE 1 " " + DO_KW 2 "do" + WHITESPACE 1 " " + ELSE_KW 4 "else" + WHITESPACE 1 " " + FALSE_KW 5 "false" + WHITESPACE 1 " " + FOR_KW 3 "for" + WHITESPACE 1 " " + FN_KW 2 "fn" + WHITESPACE 1 " " + IF_KW 2 "if" + WHITESPACE 1 " " + IN_KW 2 "in" + WHITESPACE 1 " " + NIL_KW 3 "nil" + WHITESPACE 5 "\n " + RETURN_KW 6 "return" + WHITESPACE 1 " " + TRUE_KW 4 "true" + WHITESPACE 1 " " + WHILE_KW 5 "while" + WHITESPACE 1 " " + LET_KW 3 "let" + WHITESPACE 1 " " + MUT_KW 3 "mut" + WHITESPACE 1 " " + STRUCT_KW 6 "struct" + WHITESPACE 1 " " + CLASS_KW 5 "class" + WHITESPACE 5 "\n " + NEVER_KW 5 "never" + WHITESPACE 1 " " + LOOP_KW 4 "loop" + WHITESPACE 1 " " + PUB_KW 3 "pub" + WHITESPACE 1 " " + SUPER_KW 5 "super" + WHITESPACE 1 " " + SELF_KW 4 "self" + WHITESPACE 1 " " + PACKAGE_KW 7 "package" + WHITESPACE 1 " " + TYPE_KW 4 "type" + WHITESPACE 5 "\n " + "###); } #[test] fn unclosed_string() { - lex_snapshot( + insta::assert_snapshot!(dump_text_tokens( r#" "test - "#, - ) + "#), @r###" + WHITESPACE 5 "\n " + STRING 10 "\"test\n " + "###); } #[test] fn binary_cmp() { - lex_snapshot( + insta::assert_snapshot!(dump_text_tokens( r#" a==b a ==b a== b a == b - "#, - ) + "#), @r###" + WHITESPACE 5 "\n " + IDENT 1 "a" + EQ 1 "=" + EQ 1 "=" + IDENT 1 "b" + WHITESPACE 5 "\n " + IDENT 1 "a" + WHITESPACE 1 " " + EQ 1 "=" + EQ 1 "=" + IDENT 1 "b" + WHITESPACE 5 "\n " + IDENT 1 "a" + EQ 1 "=" + EQ 1 "=" + WHITESPACE 1 " " + IDENT 1 "b" + WHITESPACE 5 "\n " + IDENT 1 "a" + WHITESPACE 1 " " + EQ 1 "=" + EQ 1 "=" + WHITESPACE 1 " " + IDENT 1 "b" + WHITESPACE 5 "\n " + "###); } diff --git a/crates/mun_syntax/src/tests/parser.rs b/crates/mun_syntax/src/tests/parser.rs index c2310363b..a9b49cf60 100644 --- a/crates/mun_syntax/src/tests/parser.rs +++ b/crates/mun_syntax/src/tests/parser.rs @@ -1,29 +1,49 @@ use crate::SourceFile; -fn snapshot_test(text: &str) { - let text = text.trim().replace("\n ", "\n"); - let file = SourceFile::parse(&text); - insta::assert_snapshot!(insta::_macro_support::AutoName, file.debug_dump(), &text); -} - #[test] fn missing_field_expr() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn foo() { var. }"#, - ); + ).debug_dump(), @r###" + SOURCE_FILE@0..34 + FUNCTION_DEF@0..34 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..11 + IDENT@8..11 "foo" + PARAM_LIST@11..13 + L_PAREN@11..12 "(" + R_PAREN@12..13 ")" + WHITESPACE@13..14 " " + BLOCK_EXPR@14..34 + L_CURLY@14..15 "{" + WHITESPACE@15..24 "\n " + FIELD_EXPR@24..28 + PATH_EXPR@24..27 + PATH@24..27 + PATH_SEGMENT@24..27 + NAME_REF@24..27 + IDENT@24..27 "var" + DOT@27..28 "." + WHITESPACE@28..33 "\n " + R_CURLY@33..34 "}" + error Offset(28): expected field name or number + "###); } #[test] fn empty() { - snapshot_test(r#""#); + insta::assert_snapshot!(SourceFile::parse(r#""#).debug_dump(), @"SOURCE_FILE@0..0 +"); } #[test] fn function() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" // Source file comment @@ -33,24 +53,184 @@ fn function() { pub fn d() {} pub fn c()->never {} fn b(value:number)->number {}"#, - ); + ).debug_dump(), @r###" + SOURCE_FILE@0..189 + WHITESPACE@0..5 "\n " + COMMENT@5..27 "// Source file comment" + WHITESPACE@27..33 "\n\n " + FUNCTION_DEF@33..86 + COMMENT@33..72 "// Comment that belon ..." + WHITESPACE@72..77 "\n " + FN_KW@77..79 "fn" + WHITESPACE@79..80 " " + NAME@80..81 + IDENT@80..81 "a" + PARAM_LIST@81..83 + L_PAREN@81..82 "(" + R_PAREN@82..83 ")" + WHITESPACE@83..84 " " + BLOCK_EXPR@84..86 + L_CURLY@84..85 "{" + R_CURLY@85..86 "}" + FUNCTION_DEF@86..112 + WHITESPACE@86..91 "\n " + FN_KW@91..93 "fn" + WHITESPACE@93..94 " " + NAME@94..95 + IDENT@94..95 "b" + PARAM_LIST@95..109 + L_PAREN@95..96 "(" + PARAM@96..108 + BIND_PAT@96..101 + NAME@96..101 + IDENT@96..101 "value" + COLON@101..102 ":" + PATH_TYPE@102..108 + PATH@102..108 + PATH_SEGMENT@102..108 + NAME_REF@102..108 + IDENT@102..108 "number" + R_PAREN@108..109 ")" + WHITESPACE@109..110 " " + BLOCK_EXPR@110..112 + L_CURLY@110..111 "{" + R_CURLY@111..112 "}" + FUNCTION_DEF@112..130 + WHITESPACE@112..117 "\n " + VISIBILITY@117..120 + PUB_KW@117..120 "pub" + WHITESPACE@120..121 " " + FN_KW@121..123 "fn" + WHITESPACE@123..124 " " + NAME@124..125 + IDENT@124..125 "d" + PARAM_LIST@125..127 + L_PAREN@125..126 "(" + R_PAREN@126..127 ")" + WHITESPACE@127..128 " " + BLOCK_EXPR@128..130 + L_CURLY@128..129 "{" + R_CURLY@129..130 "}" + FUNCTION_DEF@130..155 + WHITESPACE@130..135 "\n " + VISIBILITY@135..138 + PUB_KW@135..138 "pub" + WHITESPACE@138..139 " " + FN_KW@139..141 "fn" + WHITESPACE@141..142 " " + NAME@142..143 + IDENT@142..143 "c" + PARAM_LIST@143..145 + L_PAREN@143..144 "(" + R_PAREN@144..145 ")" + RET_TYPE@145..152 + THIN_ARROW@145..147 "->" + NEVER_TYPE@147..152 + NEVER_KW@147..152 "never" + WHITESPACE@152..153 " " + BLOCK_EXPR@153..155 + L_CURLY@153..154 "{" + R_CURLY@154..155 "}" + FUNCTION_DEF@155..189 + WHITESPACE@155..160 "\n " + FN_KW@160..162 "fn" + WHITESPACE@162..163 " " + NAME@163..164 + IDENT@163..164 "b" + PARAM_LIST@164..178 + L_PAREN@164..165 "(" + PARAM@165..177 + BIND_PAT@165..170 + NAME@165..170 + IDENT@165..170 "value" + COLON@170..171 ":" + PATH_TYPE@171..177 + PATH@171..177 + PATH_SEGMENT@171..177 + NAME_REF@171..177 + IDENT@171..177 "number" + R_PAREN@177..178 ")" + RET_TYPE@178..186 + THIN_ARROW@178..180 "->" + PATH_TYPE@180..186 + PATH@180..186 + PATH_SEGMENT@180..186 + NAME_REF@180..186 + IDENT@180..186 "number" + WHITESPACE@186..187 " " + BLOCK_EXPR@187..189 + L_CURLY@187..188 "{" + R_CURLY@188..189 "}" + "###); } #[test] fn block() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn foo() { let a; let b:i32; let c:string; }"#, - ); + ).debug_dump(), @r###" + SOURCE_FILE@0..77 + FUNCTION_DEF@0..77 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..11 + IDENT@8..11 "foo" + PARAM_LIST@11..13 + L_PAREN@11..12 "(" + R_PAREN@12..13 ")" + WHITESPACE@13..14 " " + BLOCK_EXPR@14..77 + L_CURLY@14..15 "{" + WHITESPACE@15..24 "\n " + LET_STMT@24..30 + LET_KW@24..27 "let" + WHITESPACE@27..28 " " + BIND_PAT@28..29 + NAME@28..29 + IDENT@28..29 "a" + SEMI@29..30 ";" + WHITESPACE@30..39 "\n " + LET_STMT@39..49 + LET_KW@39..42 "let" + WHITESPACE@42..43 " " + BIND_PAT@43..44 + NAME@43..44 + IDENT@43..44 "b" + COLON@44..45 ":" + PATH_TYPE@45..48 + PATH@45..48 + PATH_SEGMENT@45..48 + NAME_REF@45..48 + IDENT@45..48 "i32" + SEMI@48..49 ";" + WHITESPACE@49..58 "\n " + LET_STMT@58..71 + LET_KW@58..61 "let" + WHITESPACE@61..62 " " + BIND_PAT@62..63 + NAME@62..63 + IDENT@62..63 "c" + COLON@63..64 ":" + PATH_TYPE@64..70 + PATH@64..70 + PATH_SEGMENT@64..70 + NAME_REF@64..70 + IDENT@64..70 "string" + SEMI@70..71 ";" + WHITESPACE@71..76 "\n " + R_CURLY@76..77 "}" + "###); } #[test] fn literals() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn foo() { let a = true; @@ -60,12 +240,93 @@ fn literals() { let e = "Hello, world!" } "#, - ); + ).debug_dump(), @r###" + SOURCE_FILE@0..144 + FUNCTION_DEF@0..139 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..11 + IDENT@8..11 "foo" + PARAM_LIST@11..13 + L_PAREN@11..12 "(" + R_PAREN@12..13 ")" + WHITESPACE@13..14 " " + BLOCK_EXPR@14..139 + L_CURLY@14..15 "{" + WHITESPACE@15..24 "\n " + LET_STMT@24..37 + LET_KW@24..27 "let" + WHITESPACE@27..28 " " + BIND_PAT@28..29 + NAME@28..29 + IDENT@28..29 "a" + WHITESPACE@29..30 " " + EQ@30..31 "=" + WHITESPACE@31..32 " " + LITERAL@32..36 + TRUE_KW@32..36 "true" + SEMI@36..37 ";" + WHITESPACE@37..46 "\n " + LET_STMT@46..60 + LET_KW@46..49 "let" + WHITESPACE@49..50 " " + BIND_PAT@50..51 + NAME@50..51 + IDENT@50..51 "b" + WHITESPACE@51..52 " " + EQ@52..53 "=" + WHITESPACE@53..54 " " + LITERAL@54..59 + FALSE_KW@54..59 "false" + SEMI@59..60 ";" + WHITESPACE@60..69 "\n " + LET_STMT@69..79 + LET_KW@69..72 "let" + WHITESPACE@72..73 " " + BIND_PAT@73..74 + NAME@73..74 + IDENT@73..74 "c" + WHITESPACE@74..75 " " + EQ@75..76 "=" + WHITESPACE@76..77 " " + LITERAL@77..78 + INT_NUMBER@77..78 "1" + SEMI@78..79 ";" + WHITESPACE@79..88 "\n " + LET_STMT@88..101 + LET_KW@88..91 "let" + WHITESPACE@91..92 " " + BIND_PAT@92..93 + NAME@92..93 + IDENT@92..93 "d" + WHITESPACE@93..94 " " + EQ@94..95 "=" + WHITESPACE@95..96 " " + LITERAL@96..100 + FLOAT_NUMBER@96..100 "1.12" + SEMI@100..101 ";" + WHITESPACE@101..110 "\n " + LET_STMT@110..133 + LET_KW@110..113 "let" + WHITESPACE@113..114 " " + BIND_PAT@114..115 + NAME@114..115 + IDENT@114..115 "e" + WHITESPACE@115..116 " " + EQ@116..117 "=" + WHITESPACE@117..118 " " + LITERAL@118..133 + STRING@118..133 "\"Hello, world!\"" + WHITESPACE@133..138 "\n " + R_CURLY@138..139 "}" + WHITESPACE@139..144 "\n " + "###); } #[test] fn struct_def() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" struct Foo // error: expected a ';', or a '{' struct Foo; @@ -87,36 +348,364 @@ fn struct_def() { struct Foo(f64,); struct Foo(f64, i32) "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..468 + WHITESPACE@0..5 "\n " + STRUCT_DEF@5..15 + STRUCT_KW@5..11 "struct" + WHITESPACE@11..12 " " + NAME@12..15 + IDENT@12..15 "Foo" + WHITESPACE@15..21 " " + COMMENT@21..55 "// error: expected a ..." + WHITESPACE@55..60 "\n " + STRUCT_DEF@60..71 + STRUCT_KW@60..66 "struct" + WHITESPACE@66..67 " " + NAME@67..70 + IDENT@67..70 "Foo" + SEMI@70..71 ";" + WHITESPACE@71..76 "\n " + STRUCT_DEF@76..87 + STRUCT_KW@76..82 "struct" + WHITESPACE@82..83 " " + NAME@83..86 + IDENT@83..86 "Foo" + SEMI@86..87 ";" + ERROR@87..88 + SEMI@87..88 ";" + WHITESPACE@88..92 " " + COMMENT@92..124 "// error: expected a ..." + WHITESPACE@124..129 "\n " + STRUCT_DEF@129..142 + STRUCT_KW@129..135 "struct" + WHITESPACE@135..136 " " + NAME@136..139 + IDENT@136..139 "Foo" + WHITESPACE@139..140 " " + RECORD_FIELD_DEF_LIST@140..142 + L_CURLY@140..141 "{" + R_CURLY@141..142 "}" + WHITESPACE@142..147 "\n " + STRUCT_DEF@147..161 + STRUCT_KW@147..153 "struct" + WHITESPACE@153..154 " " + NAME@154..157 + IDENT@154..157 "Foo" + WHITESPACE@157..158 " " + RECORD_FIELD_DEF_LIST@158..161 + L_CURLY@158..159 "{" + R_CURLY@159..160 "}" + SEMI@160..161 ";" + WHITESPACE@161..166 "\n " + STRUCT_DEF@166..181 + STRUCT_KW@166..172 "struct" + WHITESPACE@172..173 " " + NAME@173..176 + IDENT@173..176 "Foo" + WHITESPACE@176..177 " " + RECORD_FIELD_DEF_LIST@177..181 + L_CURLY@177..178 "{" + ERROR@178..179 + COMMA@178..179 "," + R_CURLY@179..180 "}" + SEMI@180..181 ";" + WHITESPACE@181..182 " " + COMMENT@182..220 "// error: expected a ..." + WHITESPACE@220..225 "\n " + STRUCT_DEF@225..259 + STRUCT_KW@225..231 "struct" + WHITESPACE@231..232 " " + NAME@232..235 + IDENT@232..235 "Foo" + WHITESPACE@235..236 " " + RECORD_FIELD_DEF_LIST@236..259 + L_CURLY@236..237 "{" + WHITESPACE@237..246 "\n " + RECORD_FIELD_DEF@246..252 + NAME@246..247 + IDENT@246..247 "a" + COLON@247..248 ":" + WHITESPACE@248..249 " " + PATH_TYPE@249..252 + PATH@249..252 + PATH_SEGMENT@249..252 + NAME_REF@249..252 + IDENT@249..252 "f64" + COMMA@252..253 "," + WHITESPACE@253..258 "\n " + R_CURLY@258..259 "}" + WHITESPACE@259..264 "\n " + STRUCT_DEF@264..315 + STRUCT_KW@264..270 "struct" + WHITESPACE@270..271 " " + NAME@271..274 + IDENT@271..274 "Foo" + WHITESPACE@274..275 " " + RECORD_FIELD_DEF_LIST@275..315 + L_CURLY@275..276 "{" + WHITESPACE@276..285 "\n " + RECORD_FIELD_DEF@285..291 + NAME@285..286 + IDENT@285..286 "a" + COLON@286..287 ":" + WHITESPACE@287..288 " " + PATH_TYPE@288..291 + PATH@288..291 + PATH_SEGMENT@288..291 + NAME_REF@288..291 + IDENT@288..291 "f64" + COMMA@291..292 "," + WHITESPACE@292..301 "\n " + RECORD_FIELD_DEF@301..307 + NAME@301..302 + IDENT@301..302 "b" + COLON@302..303 ":" + WHITESPACE@303..304 " " + PATH_TYPE@304..307 + PATH@304..307 + PATH_SEGMENT@304..307 + NAME_REF@304..307 + IDENT@304..307 "i32" + COMMA@307..308 "," + WHITESPACE@308..313 "\n " + R_CURLY@313..314 "}" + SEMI@314..315 ";" + WHITESPACE@315..320 "\n " + STRUCT_DEF@320..332 + STRUCT_KW@320..326 "struct" + WHITESPACE@326..327 " " + NAME@327..330 + IDENT@327..330 "Foo" + TUPLE_FIELD_DEF_LIST@330..332 + L_PAREN@330..331 "(" + R_PAREN@331..332 ")" + WHITESPACE@332..337 "\n " + STRUCT_DEF@337..350 + STRUCT_KW@337..343 "struct" + WHITESPACE@343..344 " " + NAME@344..347 + IDENT@344..347 "Foo" + TUPLE_FIELD_DEF_LIST@347..350 + L_PAREN@347..348 "(" + R_PAREN@348..349 ")" + SEMI@349..350 ";" + WHITESPACE@350..355 "\n " + STRUCT_DEF@355..369 + STRUCT_KW@355..361 "struct" + WHITESPACE@361..362 " " + NAME@362..365 + IDENT@362..365 "Foo" + TUPLE_FIELD_DEF_LIST@365..369 + L_PAREN@365..366 "(" + ERROR@366..367 + COMMA@366..367 "," + R_PAREN@367..368 ")" + SEMI@368..369 ";" + WHITESPACE@369..371 " " + COMMENT@371..396 "// error: expected a ..." + WHITESPACE@396..401 "\n " + STRUCT_DEF@401..416 + STRUCT_KW@401..407 "struct" + WHITESPACE@407..408 " " + NAME@408..411 + IDENT@408..411 "Foo" + TUPLE_FIELD_DEF_LIST@411..416 + L_PAREN@411..412 "(" + TUPLE_FIELD_DEF@412..415 + PATH_TYPE@412..415 + PATH@412..415 + PATH_SEGMENT@412..415 + NAME_REF@412..415 + IDENT@412..415 "f64" + R_PAREN@415..416 ")" + WHITESPACE@416..421 "\n " + STRUCT_DEF@421..438 + STRUCT_KW@421..427 "struct" + WHITESPACE@427..428 " " + NAME@428..431 + IDENT@428..431 "Foo" + TUPLE_FIELD_DEF_LIST@431..438 + L_PAREN@431..432 "(" + TUPLE_FIELD_DEF@432..435 + PATH_TYPE@432..435 + PATH@432..435 + PATH_SEGMENT@432..435 + NAME_REF@432..435 + IDENT@432..435 "f64" + COMMA@435..436 "," + R_PAREN@436..437 ")" + SEMI@437..438 ";" + WHITESPACE@438..443 "\n " + STRUCT_DEF@443..463 + STRUCT_KW@443..449 "struct" + WHITESPACE@449..450 " " + NAME@450..453 + IDENT@450..453 "Foo" + TUPLE_FIELD_DEF_LIST@453..463 + L_PAREN@453..454 "(" + TUPLE_FIELD_DEF@454..457 + PATH_TYPE@454..457 + PATH@454..457 + PATH_SEGMENT@454..457 + NAME_REF@454..457 + IDENT@454..457 "f64" + COMMA@457..458 "," + WHITESPACE@458..459 " " + TUPLE_FIELD_DEF@459..462 + PATH_TYPE@459..462 + PATH@459..462 + PATH_SEGMENT@459..462 + NAME_REF@459..462 + IDENT@459..462 "i32" + R_PAREN@462..463 ")" + WHITESPACE@463..468 "\n " + error Offset(15): expected a ';', '{', or '(' + error Offset(87): expected a declaration + error Offset(178): expected a field declaration + error Offset(366): expected a type + "###); } #[test] fn unary_expr() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn foo() { let a = --3; let b = !!true; } "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..71 + FUNCTION_DEF@0..66 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..11 + IDENT@8..11 "foo" + PARAM_LIST@11..13 + L_PAREN@11..12 "(" + R_PAREN@12..13 ")" + WHITESPACE@13..14 " " + BLOCK_EXPR@14..66 + L_CURLY@14..15 "{" + WHITESPACE@15..24 "\n " + LET_STMT@24..36 + LET_KW@24..27 "let" + WHITESPACE@27..28 " " + BIND_PAT@28..29 + NAME@28..29 + IDENT@28..29 "a" + WHITESPACE@29..30 " " + EQ@30..31 "=" + WHITESPACE@31..32 " " + PREFIX_EXPR@32..35 + MINUS@32..33 "-" + PREFIX_EXPR@33..35 + MINUS@33..34 "-" + LITERAL@34..35 + INT_NUMBER@34..35 "3" + SEMI@35..36 ";" + WHITESPACE@36..45 "\n " + LET_STMT@45..60 + LET_KW@45..48 "let" + WHITESPACE@48..49 " " + BIND_PAT@49..50 + NAME@49..50 + IDENT@49..50 "b" + WHITESPACE@50..51 " " + EQ@51..52 "=" + WHITESPACE@52..53 " " + PREFIX_EXPR@53..59 + EXCLAMATION@53..54 "!" + PREFIX_EXPR@54..59 + EXCLAMATION@54..55 "!" + LITERAL@55..59 + TRUE_KW@55..59 "true" + SEMI@59..60 ";" + WHITESPACE@60..65 "\n " + R_CURLY@65..66 "}" + WHITESPACE@66..71 "\n " + "###); } #[test] fn binary_expr() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn foo() { let a = 3+4*5 let b = 3*4+10/2 } "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..73 + FUNCTION_DEF@0..68 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..11 + IDENT@8..11 "foo" + PARAM_LIST@11..13 + L_PAREN@11..12 "(" + R_PAREN@12..13 ")" + WHITESPACE@13..14 " " + BLOCK_EXPR@14..68 + L_CURLY@14..15 "{" + WHITESPACE@15..24 "\n " + LET_STMT@24..37 + LET_KW@24..27 "let" + WHITESPACE@27..28 " " + BIND_PAT@28..29 + NAME@28..29 + IDENT@28..29 "a" + WHITESPACE@29..30 " " + EQ@30..31 "=" + WHITESPACE@31..32 " " + BIN_EXPR@32..37 + LITERAL@32..33 + INT_NUMBER@32..33 "3" + PLUS@33..34 "+" + BIN_EXPR@34..37 + LITERAL@34..35 + INT_NUMBER@34..35 "4" + STAR@35..36 "*" + LITERAL@36..37 + INT_NUMBER@36..37 "5" + WHITESPACE@37..46 "\n " + LET_STMT@46..62 + LET_KW@46..49 "let" + WHITESPACE@49..50 " " + BIND_PAT@50..51 + NAME@50..51 + IDENT@50..51 "b" + WHITESPACE@51..52 " " + EQ@52..53 "=" + WHITESPACE@53..54 " " + BIN_EXPR@54..62 + BIN_EXPR@54..57 + LITERAL@54..55 + INT_NUMBER@54..55 "3" + STAR@55..56 "*" + LITERAL@56..57 + INT_NUMBER@56..57 "4" + PLUS@57..58 "+" + BIN_EXPR@58..62 + LITERAL@58..60 + INT_NUMBER@58..60 "10" + SLASH@60..61 "/" + LITERAL@61..62 + INT_NUMBER@61..62 "2" + WHITESPACE@62..67 "\n " + R_CURLY@67..68 "}" + WHITESPACE@68..73 "\n " + "###); } #[test] fn expression_statement() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn foo() { let a = "hello" @@ -127,36 +716,256 @@ fn expression_statement() { -3 } "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..148 + FUNCTION_DEF@0..143 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..11 + IDENT@8..11 "foo" + PARAM_LIST@11..13 + L_PAREN@11..12 "(" + R_PAREN@12..13 ")" + WHITESPACE@13..14 " " + BLOCK_EXPR@14..143 + L_CURLY@14..15 "{" + WHITESPACE@15..24 "\n " + LET_STMT@24..39 + LET_KW@24..27 "let" + WHITESPACE@27..28 " " + BIND_PAT@28..29 + NAME@28..29 + IDENT@28..29 "a" + WHITESPACE@29..30 " " + EQ@30..31 "=" + WHITESPACE@31..32 " " + LITERAL@32..39 + STRING@32..39 "\"hello\"" + WHITESPACE@39..48 "\n " + LET_STMT@48..63 + LET_KW@48..51 "let" + WHITESPACE@51..52 " " + BIND_PAT@52..53 + NAME@52..53 + IDENT@52..53 "b" + WHITESPACE@53..54 " " + EQ@54..55 "=" + WHITESPACE@55..56 " " + LITERAL@56..63 + STRING@56..63 "\"world\"" + WHITESPACE@63..72 "\n " + LET_STMT@72..77 + LET_KW@72..75 "let" + WHITESPACE@75..76 " " + BIND_PAT@76..77 + NAME@76..77 + IDENT@76..77 "c" + WHITESPACE@77..86 "\n " + EXPR_STMT@86..105 + BIN_EXPR@86..105 + PATH_EXPR@86..87 + PATH@86..87 + PATH_SEGMENT@86..87 + NAME_REF@86..87 + IDENT@86..87 "b" + WHITESPACE@87..88 " " + EQ@88..89 "=" + WHITESPACE@89..90 " " + LITERAL@90..105 + STRING@90..105 "\"Hello, world!\"" + WHITESPACE@105..114 "\n " + EXPR_STMT@114..126 + BIN_EXPR@114..125 + PREFIX_EXPR@114..117 + EXCLAMATION@114..115 "!" + PREFIX_EXPR@115..117 + MINUS@115..116 "-" + LITERAL@116..117 + INT_NUMBER@116..117 "5" + PLUS@117..118 "+" + BIN_EXPR@118..125 + LITERAL@118..119 + INT_NUMBER@118..119 "2" + STAR@119..120 "*" + PAREN_EXPR@120..125 + L_PAREN@120..121 "(" + BIN_EXPR@121..124 + PATH_EXPR@121..122 + PATH@121..122 + PATH_SEGMENT@121..122 + NAME_REF@121..122 + IDENT@121..122 "a" + PLUS@122..123 "+" + PATH_EXPR@123..124 + PATH@123..124 + PATH_SEGMENT@123..124 + NAME_REF@123..124 + IDENT@123..124 "b" + R_PAREN@124..125 ")" + SEMI@125..126 ";" + WHITESPACE@126..135 "\n " + PREFIX_EXPR@135..137 + MINUS@135..136 "-" + LITERAL@136..137 + INT_NUMBER@136..137 "3" + WHITESPACE@137..142 "\n " + R_CURLY@142..143 "}" + WHITESPACE@143..148 "\n " + "###); } #[test] fn function_calls() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn bar(i:number) { } fn foo(i:number) { bar(i+1) } "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..74 + FUNCTION_DEF@0..25 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..11 + IDENT@8..11 "bar" + PARAM_LIST@11..21 + L_PAREN@11..12 "(" + PARAM@12..20 + BIND_PAT@12..13 + NAME@12..13 + IDENT@12..13 "i" + COLON@13..14 ":" + PATH_TYPE@14..20 + PATH@14..20 + PATH_SEGMENT@14..20 + NAME_REF@14..20 + IDENT@14..20 "number" + R_PAREN@20..21 ")" + WHITESPACE@21..22 " " + BLOCK_EXPR@22..25 + L_CURLY@22..23 "{" + WHITESPACE@23..24 " " + R_CURLY@24..25 "}" + FUNCTION_DEF@25..69 + WHITESPACE@25..30 "\n " + FN_KW@30..32 "fn" + WHITESPACE@32..33 " " + NAME@33..36 + IDENT@33..36 "foo" + PARAM_LIST@36..46 + L_PAREN@36..37 "(" + PARAM@37..45 + BIND_PAT@37..38 + NAME@37..38 + IDENT@37..38 "i" + COLON@38..39 ":" + PATH_TYPE@39..45 + PATH@39..45 + PATH_SEGMENT@39..45 + NAME_REF@39..45 + IDENT@39..45 "number" + R_PAREN@45..46 ")" + WHITESPACE@46..47 " " + BLOCK_EXPR@47..69 + L_CURLY@47..48 "{" + WHITESPACE@48..55 "\n " + CALL_EXPR@55..63 + PATH_EXPR@55..58 + PATH@55..58 + PATH_SEGMENT@55..58 + NAME_REF@55..58 + IDENT@55..58 "bar" + ARG_LIST@58..63 + L_PAREN@58..59 "(" + BIN_EXPR@59..62 + PATH_EXPR@59..60 + PATH@59..60 + PATH_SEGMENT@59..60 + NAME_REF@59..60 + IDENT@59..60 "i" + PLUS@60..61 "+" + LITERAL@61..62 + INT_NUMBER@61..62 "1" + R_PAREN@62..63 ")" + WHITESPACE@63..68 "\n " + R_CURLY@68..69 "}" + WHITESPACE@69..74 "\n " + "###); } #[test] fn patterns() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn main(_:number) { let a = 0; let _ = a; } "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..71 + FUNCTION_DEF@0..66 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..12 + IDENT@8..12 "main" + PARAM_LIST@12..22 + L_PAREN@12..13 "(" + PARAM@13..21 + PLACEHOLDER_PAT@13..14 + UNDERSCORE@13..14 "_" + COLON@14..15 ":" + PATH_TYPE@15..21 + PATH@15..21 + PATH_SEGMENT@15..21 + NAME_REF@15..21 + IDENT@15..21 "number" + R_PAREN@21..22 ")" + WHITESPACE@22..23 " " + BLOCK_EXPR@23..66 + L_CURLY@23..24 "{" + WHITESPACE@24..32 "\n " + LET_STMT@32..42 + LET_KW@32..35 "let" + WHITESPACE@35..36 " " + BIND_PAT@36..37 + NAME@36..37 + IDENT@36..37 "a" + WHITESPACE@37..38 " " + EQ@38..39 "=" + WHITESPACE@39..40 " " + LITERAL@40..41 + INT_NUMBER@40..41 "0" + SEMI@41..42 ";" + WHITESPACE@42..50 "\n " + LET_STMT@50..60 + LET_KW@50..53 "let" + WHITESPACE@53..54 " " + PLACEHOLDER_PAT@54..55 + UNDERSCORE@54..55 "_" + WHITESPACE@55..56 " " + EQ@56..57 "=" + WHITESPACE@57..58 " " + PATH_EXPR@58..59 + PATH@58..59 + PATH_SEGMENT@58..59 + NAME_REF@58..59 + IDENT@58..59 "a" + SEMI@59..60 ";" + WHITESPACE@60..65 "\n " + R_CURLY@65..66 "}" + WHITESPACE@66..71 "\n " + "###); } #[test] fn arithmetic_operands() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn main() { let _ = a + b; @@ -171,12 +980,269 @@ fn arithmetic_operands() { let _ = a ^ b; } "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..259 + FUNCTION_DEF@0..254 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..12 + IDENT@8..12 "main" + PARAM_LIST@12..14 + L_PAREN@12..13 "(" + R_PAREN@13..14 ")" + WHITESPACE@14..15 " " + BLOCK_EXPR@15..254 + L_CURLY@15..16 "{" + WHITESPACE@16..25 "\n " + LET_STMT@25..39 + LET_KW@25..28 "let" + WHITESPACE@28..29 " " + PLACEHOLDER_PAT@29..30 + UNDERSCORE@29..30 "_" + WHITESPACE@30..31 " " + EQ@31..32 "=" + WHITESPACE@32..33 " " + BIN_EXPR@33..38 + PATH_EXPR@33..34 + PATH@33..34 + PATH_SEGMENT@33..34 + NAME_REF@33..34 + IDENT@33..34 "a" + WHITESPACE@34..35 " " + PLUS@35..36 "+" + WHITESPACE@36..37 " " + PATH_EXPR@37..38 + PATH@37..38 + PATH_SEGMENT@37..38 + NAME_REF@37..38 + IDENT@37..38 "b" + SEMI@38..39 ";" + WHITESPACE@39..48 "\n " + LET_STMT@48..62 + LET_KW@48..51 "let" + WHITESPACE@51..52 " " + PLACEHOLDER_PAT@52..53 + UNDERSCORE@52..53 "_" + WHITESPACE@53..54 " " + EQ@54..55 "=" + WHITESPACE@55..56 " " + BIN_EXPR@56..61 + PATH_EXPR@56..57 + PATH@56..57 + PATH_SEGMENT@56..57 + NAME_REF@56..57 + IDENT@56..57 "a" + WHITESPACE@57..58 " " + MINUS@58..59 "-" + WHITESPACE@59..60 " " + PATH_EXPR@60..61 + PATH@60..61 + PATH_SEGMENT@60..61 + NAME_REF@60..61 + IDENT@60..61 "b" + SEMI@61..62 ";" + WHITESPACE@62..71 "\n " + LET_STMT@71..85 + LET_KW@71..74 "let" + WHITESPACE@74..75 " " + PLACEHOLDER_PAT@75..76 + UNDERSCORE@75..76 "_" + WHITESPACE@76..77 " " + EQ@77..78 "=" + WHITESPACE@78..79 " " + BIN_EXPR@79..84 + PATH_EXPR@79..80 + PATH@79..80 + PATH_SEGMENT@79..80 + NAME_REF@79..80 + IDENT@79..80 "a" + WHITESPACE@80..81 " " + STAR@81..82 "*" + WHITESPACE@82..83 " " + PATH_EXPR@83..84 + PATH@83..84 + PATH_SEGMENT@83..84 + NAME_REF@83..84 + IDENT@83..84 "b" + SEMI@84..85 ";" + WHITESPACE@85..94 "\n " + LET_STMT@94..108 + LET_KW@94..97 "let" + WHITESPACE@97..98 " " + PLACEHOLDER_PAT@98..99 + UNDERSCORE@98..99 "_" + WHITESPACE@99..100 " " + EQ@100..101 "=" + WHITESPACE@101..102 " " + BIN_EXPR@102..107 + PATH_EXPR@102..103 + PATH@102..103 + PATH_SEGMENT@102..103 + NAME_REF@102..103 + IDENT@102..103 "a" + WHITESPACE@103..104 " " + SLASH@104..105 "/" + WHITESPACE@105..106 " " + PATH_EXPR@106..107 + PATH@106..107 + PATH_SEGMENT@106..107 + NAME_REF@106..107 + IDENT@106..107 "b" + SEMI@107..108 ";" + WHITESPACE@108..117 "\n " + LET_STMT@117..131 + LET_KW@117..120 "let" + WHITESPACE@120..121 " " + PLACEHOLDER_PAT@121..122 + UNDERSCORE@121..122 "_" + WHITESPACE@122..123 " " + EQ@123..124 "=" + WHITESPACE@124..125 " " + BIN_EXPR@125..130 + PATH_EXPR@125..126 + PATH@125..126 + PATH_SEGMENT@125..126 + NAME_REF@125..126 + IDENT@125..126 "a" + WHITESPACE@126..127 " " + PERCENT@127..128 "%" + WHITESPACE@128..129 " " + PATH_EXPR@129..130 + PATH@129..130 + PATH_SEGMENT@129..130 + NAME_REF@129..130 + IDENT@129..130 "b" + SEMI@130..131 ";" + WHITESPACE@131..140 "\n " + LET_STMT@140..155 + LET_KW@140..143 "let" + WHITESPACE@143..144 " " + PLACEHOLDER_PAT@144..145 + UNDERSCORE@144..145 "_" + WHITESPACE@145..146 " " + EQ@146..147 "=" + WHITESPACE@147..148 " " + BIN_EXPR@148..154 + PATH_EXPR@148..149 + PATH@148..149 + PATH_SEGMENT@148..149 + NAME_REF@148..149 + IDENT@148..149 "a" + WHITESPACE@149..150 " " + SHL@150..152 "<<" + WHITESPACE@152..153 " " + PATH_EXPR@153..154 + PATH@153..154 + PATH_SEGMENT@153..154 + NAME_REF@153..154 + IDENT@153..154 "b" + SEMI@154..155 ";" + WHITESPACE@155..164 "\n " + LET_STMT@164..179 + LET_KW@164..167 "let" + WHITESPACE@167..168 " " + PLACEHOLDER_PAT@168..169 + UNDERSCORE@168..169 "_" + WHITESPACE@169..170 " " + EQ@170..171 "=" + WHITESPACE@171..172 " " + BIN_EXPR@172..178 + PATH_EXPR@172..173 + PATH@172..173 + PATH_SEGMENT@172..173 + NAME_REF@172..173 + IDENT@172..173 "a" + WHITESPACE@173..174 " " + SHR@174..176 ">>" + WHITESPACE@176..177 " " + PATH_EXPR@177..178 + PATH@177..178 + PATH_SEGMENT@177..178 + NAME_REF@177..178 + IDENT@177..178 "b" + SEMI@178..179 ";" + WHITESPACE@179..188 "\n " + LET_STMT@188..202 + LET_KW@188..191 "let" + WHITESPACE@191..192 " " + PLACEHOLDER_PAT@192..193 + UNDERSCORE@192..193 "_" + WHITESPACE@193..194 " " + EQ@194..195 "=" + WHITESPACE@195..196 " " + BIN_EXPR@196..201 + PATH_EXPR@196..197 + PATH@196..197 + PATH_SEGMENT@196..197 + NAME_REF@196..197 + IDENT@196..197 "a" + WHITESPACE@197..198 " " + AMP@198..199 "&" + WHITESPACE@199..200 " " + PATH_EXPR@200..201 + PATH@200..201 + PATH_SEGMENT@200..201 + NAME_REF@200..201 + IDENT@200..201 "b" + SEMI@201..202 ";" + WHITESPACE@202..211 "\n " + LET_STMT@211..225 + LET_KW@211..214 "let" + WHITESPACE@214..215 " " + PLACEHOLDER_PAT@215..216 + UNDERSCORE@215..216 "_" + WHITESPACE@216..217 " " + EQ@217..218 "=" + WHITESPACE@218..219 " " + BIN_EXPR@219..224 + PATH_EXPR@219..220 + PATH@219..220 + PATH_SEGMENT@219..220 + NAME_REF@219..220 + IDENT@219..220 "a" + WHITESPACE@220..221 " " + PIPE@221..222 "|" + WHITESPACE@222..223 " " + PATH_EXPR@223..224 + PATH@223..224 + PATH_SEGMENT@223..224 + NAME_REF@223..224 + IDENT@223..224 "b" + SEMI@224..225 ";" + WHITESPACE@225..234 "\n " + LET_STMT@234..248 + LET_KW@234..237 "let" + WHITESPACE@237..238 " " + PLACEHOLDER_PAT@238..239 + UNDERSCORE@238..239 "_" + WHITESPACE@239..240 " " + EQ@240..241 "=" + WHITESPACE@241..242 " " + BIN_EXPR@242..247 + PATH_EXPR@242..243 + PATH@242..243 + PATH_SEGMENT@242..243 + NAME_REF@242..243 + IDENT@242..243 "a" + WHITESPACE@243..244 " " + CARET@244..245 "^" + WHITESPACE@245..246 " " + PATH_EXPR@246..247 + PATH@246..247 + PATH_SEGMENT@246..247 + NAME_REF@246..247 + IDENT@246..247 "b" + SEMI@247..248 ";" + WHITESPACE@248..253 "\n " + R_CURLY@253..254 "}" + WHITESPACE@254..259 "\n " + "###); } #[test] fn assignment_operands() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn main() { let a = b; @@ -192,12 +1258,215 @@ fn assignment_operands() { a ^= b; } "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..208 + FUNCTION_DEF@0..203 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..12 + IDENT@8..12 "main" + PARAM_LIST@12..14 + L_PAREN@12..13 "(" + R_PAREN@13..14 ")" + WHITESPACE@14..15 " " + BLOCK_EXPR@15..203 + L_CURLY@15..16 "{" + WHITESPACE@16..25 "\n " + LET_STMT@25..35 + LET_KW@25..28 "let" + WHITESPACE@28..29 " " + BIND_PAT@29..30 + NAME@29..30 + IDENT@29..30 "a" + WHITESPACE@30..31 " " + EQ@31..32 "=" + WHITESPACE@32..33 " " + PATH_EXPR@33..34 + PATH@33..34 + PATH_SEGMENT@33..34 + NAME_REF@33..34 + IDENT@33..34 "b" + SEMI@34..35 ";" + WHITESPACE@35..44 "\n " + EXPR_STMT@44..51 + BIN_EXPR@44..50 + PATH_EXPR@44..45 + PATH@44..45 + PATH_SEGMENT@44..45 + NAME_REF@44..45 + IDENT@44..45 "a" + WHITESPACE@45..46 " " + PLUSEQ@46..48 "+=" + WHITESPACE@48..49 " " + PATH_EXPR@49..50 + PATH@49..50 + PATH_SEGMENT@49..50 + NAME_REF@49..50 + IDENT@49..50 "b" + SEMI@50..51 ";" + WHITESPACE@51..60 "\n " + EXPR_STMT@60..67 + BIN_EXPR@60..66 + PATH_EXPR@60..61 + PATH@60..61 + PATH_SEGMENT@60..61 + NAME_REF@60..61 + IDENT@60..61 "a" + WHITESPACE@61..62 " " + MINUSEQ@62..64 "-=" + WHITESPACE@64..65 " " + PATH_EXPR@65..66 + PATH@65..66 + PATH_SEGMENT@65..66 + NAME_REF@65..66 + IDENT@65..66 "b" + SEMI@66..67 ";" + WHITESPACE@67..76 "\n " + EXPR_STMT@76..83 + BIN_EXPR@76..82 + PATH_EXPR@76..77 + PATH@76..77 + PATH_SEGMENT@76..77 + NAME_REF@76..77 + IDENT@76..77 "a" + WHITESPACE@77..78 " " + STAREQ@78..80 "*=" + WHITESPACE@80..81 " " + PATH_EXPR@81..82 + PATH@81..82 + PATH_SEGMENT@81..82 + NAME_REF@81..82 + IDENT@81..82 "b" + SEMI@82..83 ";" + WHITESPACE@83..92 "\n " + EXPR_STMT@92..99 + BIN_EXPR@92..98 + PATH_EXPR@92..93 + PATH@92..93 + PATH_SEGMENT@92..93 + NAME_REF@92..93 + IDENT@92..93 "a" + WHITESPACE@93..94 " " + SLASHEQ@94..96 "/=" + WHITESPACE@96..97 " " + PATH_EXPR@97..98 + PATH@97..98 + PATH_SEGMENT@97..98 + NAME_REF@97..98 + IDENT@97..98 "b" + SEMI@98..99 ";" + WHITESPACE@99..108 "\n " + EXPR_STMT@108..115 + BIN_EXPR@108..114 + PATH_EXPR@108..109 + PATH@108..109 + PATH_SEGMENT@108..109 + NAME_REF@108..109 + IDENT@108..109 "a" + WHITESPACE@109..110 " " + PERCENTEQ@110..112 "%=" + WHITESPACE@112..113 " " + PATH_EXPR@113..114 + PATH@113..114 + PATH_SEGMENT@113..114 + NAME_REF@113..114 + IDENT@113..114 "b" + SEMI@114..115 ";" + WHITESPACE@115..124 "\n " + EXPR_STMT@124..132 + BIN_EXPR@124..131 + PATH_EXPR@124..125 + PATH@124..125 + PATH_SEGMENT@124..125 + NAME_REF@124..125 + IDENT@124..125 "a" + WHITESPACE@125..126 " " + SHLEQ@126..129 "<<=" + WHITESPACE@129..130 " " + PATH_EXPR@130..131 + PATH@130..131 + PATH_SEGMENT@130..131 + NAME_REF@130..131 + IDENT@130..131 "b" + SEMI@131..132 ";" + WHITESPACE@132..141 "\n " + EXPR_STMT@141..149 + BIN_EXPR@141..148 + PATH_EXPR@141..142 + PATH@141..142 + PATH_SEGMENT@141..142 + NAME_REF@141..142 + IDENT@141..142 "a" + WHITESPACE@142..143 " " + SHREQ@143..146 ">>=" + WHITESPACE@146..147 " " + PATH_EXPR@147..148 + PATH@147..148 + PATH_SEGMENT@147..148 + NAME_REF@147..148 + IDENT@147..148 "b" + SEMI@148..149 ";" + WHITESPACE@149..158 "\n " + EXPR_STMT@158..165 + BIN_EXPR@158..164 + PATH_EXPR@158..159 + PATH@158..159 + PATH_SEGMENT@158..159 + NAME_REF@158..159 + IDENT@158..159 "a" + WHITESPACE@159..160 " " + AMPEQ@160..162 "&=" + WHITESPACE@162..163 " " + PATH_EXPR@163..164 + PATH@163..164 + PATH_SEGMENT@163..164 + NAME_REF@163..164 + IDENT@163..164 "b" + SEMI@164..165 ";" + WHITESPACE@165..174 "\n " + EXPR_STMT@174..181 + BIN_EXPR@174..180 + PATH_EXPR@174..175 + PATH@174..175 + PATH_SEGMENT@174..175 + NAME_REF@174..175 + IDENT@174..175 "a" + WHITESPACE@175..176 " " + PIPEEQ@176..178 "|=" + WHITESPACE@178..179 " " + PATH_EXPR@179..180 + PATH@179..180 + PATH_SEGMENT@179..180 + NAME_REF@179..180 + IDENT@179..180 "b" + SEMI@180..181 ";" + WHITESPACE@181..190 "\n " + EXPR_STMT@190..197 + BIN_EXPR@190..196 + PATH_EXPR@190..191 + PATH@190..191 + PATH_SEGMENT@190..191 + NAME_REF@190..191 + IDENT@190..191 "a" + WHITESPACE@191..192 " " + CARETEQ@192..194 "^=" + WHITESPACE@194..195 " " + PATH_EXPR@195..196 + PATH@195..196 + PATH_SEGMENT@195..196 + NAME_REF@195..196 + IDENT@195..196 "b" + SEMI@196..197 ";" + WHITESPACE@197..202 "\n " + R_CURLY@202..203 "}" + WHITESPACE@203..208 "\n " + "###); } #[test] fn compare_operands() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn main() { let _ = a == b; @@ -209,24 +1478,274 @@ fn compare_operands() { let _ = a >= b; } "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..193 + FUNCTION_DEF@0..188 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..12 + IDENT@8..12 "main" + PARAM_LIST@12..14 + L_PAREN@12..13 "(" + R_PAREN@13..14 ")" + WHITESPACE@14..15 " " + BLOCK_EXPR@15..188 + L_CURLY@15..16 "{" + WHITESPACE@16..25 "\n " + LET_STMT@25..40 + LET_KW@25..28 "let" + WHITESPACE@28..29 " " + PLACEHOLDER_PAT@29..30 + UNDERSCORE@29..30 "_" + WHITESPACE@30..31 " " + EQ@31..32 "=" + WHITESPACE@32..33 " " + BIN_EXPR@33..39 + PATH_EXPR@33..34 + PATH@33..34 + PATH_SEGMENT@33..34 + NAME_REF@33..34 + IDENT@33..34 "a" + WHITESPACE@34..35 " " + EQEQ@35..37 "==" + WHITESPACE@37..38 " " + PATH_EXPR@38..39 + PATH@38..39 + PATH_SEGMENT@38..39 + NAME_REF@38..39 + IDENT@38..39 "b" + SEMI@39..40 ";" + WHITESPACE@40..49 "\n " + LET_STMT@49..64 + LET_KW@49..52 "let" + WHITESPACE@52..53 " " + PLACEHOLDER_PAT@53..54 + UNDERSCORE@53..54 "_" + WHITESPACE@54..55 " " + EQ@55..56 "=" + WHITESPACE@56..57 " " + BIN_EXPR@57..63 + PATH_EXPR@57..58 + PATH@57..58 + PATH_SEGMENT@57..58 + NAME_REF@57..58 + IDENT@57..58 "a" + WHITESPACE@58..59 " " + EQEQ@59..61 "==" + WHITESPACE@61..62 " " + PATH_EXPR@62..63 + PATH@62..63 + PATH_SEGMENT@62..63 + NAME_REF@62..63 + IDENT@62..63 "b" + SEMI@63..64 ";" + WHITESPACE@64..73 "\n " + LET_STMT@73..88 + LET_KW@73..76 "let" + WHITESPACE@76..77 " " + PLACEHOLDER_PAT@77..78 + UNDERSCORE@77..78 "_" + WHITESPACE@78..79 " " + EQ@79..80 "=" + WHITESPACE@80..81 " " + BIN_EXPR@81..87 + PATH_EXPR@81..82 + PATH@81..82 + PATH_SEGMENT@81..82 + NAME_REF@81..82 + IDENT@81..82 "a" + WHITESPACE@82..83 " " + NEQ@83..85 "!=" + WHITESPACE@85..86 " " + PATH_EXPR@86..87 + PATH@86..87 + PATH_SEGMENT@86..87 + NAME_REF@86..87 + IDENT@86..87 "b" + SEMI@87..88 ";" + WHITESPACE@88..97 "\n " + LET_STMT@97..111 + LET_KW@97..100 "let" + WHITESPACE@100..101 " " + PLACEHOLDER_PAT@101..102 + UNDERSCORE@101..102 "_" + WHITESPACE@102..103 " " + EQ@103..104 "=" + WHITESPACE@104..105 " " + BIN_EXPR@105..110 + PATH_EXPR@105..106 + PATH@105..106 + PATH_SEGMENT@105..106 + NAME_REF@105..106 + IDENT@105..106 "a" + WHITESPACE@106..107 " " + LT@107..108 "<" + WHITESPACE@108..109 " " + PATH_EXPR@109..110 + PATH@109..110 + PATH_SEGMENT@109..110 + NAME_REF@109..110 + IDENT@109..110 "b" + SEMI@110..111 ";" + WHITESPACE@111..120 "\n " + LET_STMT@120..134 + LET_KW@120..123 "let" + WHITESPACE@123..124 " " + PLACEHOLDER_PAT@124..125 + UNDERSCORE@124..125 "_" + WHITESPACE@125..126 " " + EQ@126..127 "=" + WHITESPACE@127..128 " " + BIN_EXPR@128..133 + PATH_EXPR@128..129 + PATH@128..129 + PATH_SEGMENT@128..129 + NAME_REF@128..129 + IDENT@128..129 "a" + WHITESPACE@129..130 " " + GT@130..131 ">" + WHITESPACE@131..132 " " + PATH_EXPR@132..133 + PATH@132..133 + PATH_SEGMENT@132..133 + NAME_REF@132..133 + IDENT@132..133 "b" + SEMI@133..134 ";" + WHITESPACE@134..143 "\n " + LET_STMT@143..158 + LET_KW@143..146 "let" + WHITESPACE@146..147 " " + PLACEHOLDER_PAT@147..148 + UNDERSCORE@147..148 "_" + WHITESPACE@148..149 " " + EQ@149..150 "=" + WHITESPACE@150..151 " " + BIN_EXPR@151..157 + PATH_EXPR@151..152 + PATH@151..152 + PATH_SEGMENT@151..152 + NAME_REF@151..152 + IDENT@151..152 "a" + WHITESPACE@152..153 " " + LTEQ@153..155 "<=" + WHITESPACE@155..156 " " + PATH_EXPR@156..157 + PATH@156..157 + PATH_SEGMENT@156..157 + NAME_REF@156..157 + IDENT@156..157 "b" + SEMI@157..158 ";" + WHITESPACE@158..167 "\n " + LET_STMT@167..182 + LET_KW@167..170 "let" + WHITESPACE@170..171 " " + PLACEHOLDER_PAT@171..172 + UNDERSCORE@171..172 "_" + WHITESPACE@172..173 " " + EQ@173..174 "=" + WHITESPACE@174..175 " " + BIN_EXPR@175..181 + PATH_EXPR@175..176 + PATH@175..176 + PATH_SEGMENT@175..176 + NAME_REF@175..176 + IDENT@175..176 "a" + WHITESPACE@176..177 " " + GTEQ@177..179 ">=" + WHITESPACE@179..180 " " + PATH_EXPR@180..181 + PATH@180..181 + PATH_SEGMENT@180..181 + NAME_REF@180..181 + IDENT@180..181 "b" + SEMI@181..182 ";" + WHITESPACE@182..187 "\n " + R_CURLY@187..188 "}" + WHITESPACE@188..193 "\n " + "###); } #[test] fn logic_operands() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn main() { let _ = a || b; let _ = a && b; } "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..75 + FUNCTION_DEF@0..70 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..12 + IDENT@8..12 "main" + PARAM_LIST@12..14 + L_PAREN@12..13 "(" + R_PAREN@13..14 ")" + WHITESPACE@14..15 " " + BLOCK_EXPR@15..70 + L_CURLY@15..16 "{" + WHITESPACE@16..25 "\n " + LET_STMT@25..40 + LET_KW@25..28 "let" + WHITESPACE@28..29 " " + PLACEHOLDER_PAT@29..30 + UNDERSCORE@29..30 "_" + WHITESPACE@30..31 " " + EQ@31..32 "=" + WHITESPACE@32..33 " " + BIN_EXPR@33..39 + PATH_EXPR@33..34 + PATH@33..34 + PATH_SEGMENT@33..34 + NAME_REF@33..34 + IDENT@33..34 "a" + WHITESPACE@34..35 " " + PIPEPIPE@35..37 "||" + WHITESPACE@37..38 " " + PATH_EXPR@38..39 + PATH@38..39 + PATH_SEGMENT@38..39 + NAME_REF@38..39 + IDENT@38..39 "b" + SEMI@39..40 ";" + WHITESPACE@40..49 "\n " + LET_STMT@49..64 + LET_KW@49..52 "let" + WHITESPACE@52..53 " " + PLACEHOLDER_PAT@53..54 + UNDERSCORE@53..54 "_" + WHITESPACE@54..55 " " + EQ@55..56 "=" + WHITESPACE@56..57 " " + BIN_EXPR@57..63 + PATH_EXPR@57..58 + PATH@57..58 + PATH_SEGMENT@57..58 + NAME_REF@57..58 + IDENT@57..58 "a" + WHITESPACE@58..59 " " + AMPAMP@59..61 "&&" + WHITESPACE@61..62 " " + PATH_EXPR@62..63 + PATH@62..63 + PATH_SEGMENT@62..63 + NAME_REF@62..63 + IDENT@62..63 "b" + SEMI@63..64 ";" + WHITESPACE@64..69 "\n " + R_CURLY@69..70 "}" + WHITESPACE@70..75 "\n " + "###); } #[test] fn if_expr() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn bar() { if true {}; @@ -235,45 +1754,222 @@ fn if_expr() { if {true} {} else {} } "#, - ); + ).debug_dump(), @r###" + SOURCE_FILE@0..148 + FUNCTION_DEF@0..143 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..11 + IDENT@8..11 "bar" + PARAM_LIST@11..13 + L_PAREN@11..12 "(" + R_PAREN@12..13 ")" + WHITESPACE@13..14 " " + BLOCK_EXPR@14..143 + L_CURLY@14..15 "{" + WHITESPACE@15..24 "\n " + EXPR_STMT@24..35 + IF_EXPR@24..34 + IF_KW@24..26 "if" + WHITESPACE@26..27 " " + CONDITION@27..31 + LITERAL@27..31 + TRUE_KW@27..31 "true" + WHITESPACE@31..32 " " + BLOCK_EXPR@32..34 + L_CURLY@32..33 "{" + R_CURLY@33..34 "}" + SEMI@34..35 ";" + WHITESPACE@35..44 "\n " + EXPR_STMT@44..63 + IF_EXPR@44..62 + IF_KW@44..46 "if" + WHITESPACE@46..47 " " + CONDITION@47..51 + LITERAL@47..51 + TRUE_KW@47..51 "true" + WHITESPACE@51..52 " " + BLOCK_EXPR@52..54 + L_CURLY@52..53 "{" + R_CURLY@53..54 "}" + WHITESPACE@54..55 " " + ELSE_KW@55..59 "else" + WHITESPACE@59..60 " " + BLOCK_EXPR@60..62 + L_CURLY@60..61 "{" + R_CURLY@61..62 "}" + SEMI@62..63 ";" + WHITESPACE@63..72 "\n " + EXPR_STMT@72..108 + IF_EXPR@72..107 + IF_KW@72..74 "if" + WHITESPACE@74..75 " " + CONDITION@75..79 + LITERAL@75..79 + TRUE_KW@75..79 "true" + WHITESPACE@79..80 " " + BLOCK_EXPR@80..82 + L_CURLY@80..81 "{" + R_CURLY@81..82 "}" + WHITESPACE@82..83 " " + ELSE_KW@83..87 "else" + WHITESPACE@87..88 " " + IF_EXPR@88..107 + IF_KW@88..90 "if" + WHITESPACE@90..91 " " + CONDITION@91..96 + LITERAL@91..96 + FALSE_KW@91..96 "false" + WHITESPACE@96..97 " " + BLOCK_EXPR@97..99 + L_CURLY@97..98 "{" + R_CURLY@98..99 "}" + WHITESPACE@99..100 " " + ELSE_KW@100..104 "else" + WHITESPACE@104..105 " " + BLOCK_EXPR@105..107 + L_CURLY@105..106 "{" + R_CURLY@106..107 "}" + SEMI@107..108 ";" + WHITESPACE@108..117 "\n " + IF_EXPR@117..137 + IF_KW@117..119 "if" + WHITESPACE@119..120 " " + CONDITION@120..126 + BLOCK_EXPR@120..126 + L_CURLY@120..121 "{" + LITERAL@121..125 + TRUE_KW@121..125 "true" + R_CURLY@125..126 "}" + WHITESPACE@126..127 " " + BLOCK_EXPR@127..129 + L_CURLY@127..128 "{" + R_CURLY@128..129 "}" + WHITESPACE@129..130 " " + ELSE_KW@130..134 "else" + WHITESPACE@134..135 " " + BLOCK_EXPR@135..137 + L_CURLY@135..136 "{" + R_CURLY@136..137 "}" + WHITESPACE@137..142 "\n " + R_CURLY@142..143 "}" + WHITESPACE@143..148 "\n " + "###); } #[test] fn block_expr() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn bar() { {3} } "#, - ); + ).debug_dump(), @r###" + SOURCE_FILE@0..38 + FUNCTION_DEF@0..33 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..11 + IDENT@8..11 "bar" + PARAM_LIST@11..13 + L_PAREN@11..12 "(" + R_PAREN@12..13 ")" + WHITESPACE@13..14 " " + BLOCK_EXPR@14..33 + L_CURLY@14..15 "{" + WHITESPACE@15..24 "\n " + BLOCK_EXPR@24..27 + L_CURLY@24..25 "{" + LITERAL@25..26 + INT_NUMBER@25..26 "3" + R_CURLY@26..27 "}" + WHITESPACE@27..32 "\n " + R_CURLY@32..33 "}" + WHITESPACE@33..38 "\n " + "###); } #[test] fn return_expr() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn foo() { return; return 50; } "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..61 + FUNCTION_DEF@0..56 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..11 + IDENT@8..11 "foo" + PARAM_LIST@11..13 + L_PAREN@11..12 "(" + R_PAREN@12..13 ")" + WHITESPACE@13..14 " " + BLOCK_EXPR@14..56 + L_CURLY@14..15 "{" + WHITESPACE@15..24 "\n " + EXPR_STMT@24..31 + RETURN_EXPR@24..30 + RETURN_KW@24..30 "return" + SEMI@30..31 ";" + WHITESPACE@31..40 "\n " + EXPR_STMT@40..50 + RETURN_EXPR@40..49 + RETURN_KW@40..46 "return" + WHITESPACE@46..47 " " + LITERAL@47..49 + INT_NUMBER@47..49 "50" + SEMI@49..50 ";" + WHITESPACE@50..55 "\n " + R_CURLY@55..56 "}" + WHITESPACE@56..61 "\n " + "###); } #[test] fn loop_expr() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn foo() { loop {} }"#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..37 + FUNCTION_DEF@0..37 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..11 + IDENT@8..11 "foo" + PARAM_LIST@11..13 + L_PAREN@11..12 "(" + R_PAREN@12..13 ")" + WHITESPACE@13..14 " " + BLOCK_EXPR@14..37 + L_CURLY@14..15 "{" + WHITESPACE@15..24 "\n " + LOOP_EXPR@24..31 + LOOP_KW@24..28 "loop" + WHITESPACE@28..29 " " + BLOCK_EXPR@29..31 + L_CURLY@29..30 "{" + R_CURLY@30..31 "}" + WHITESPACE@31..36 "\n " + R_CURLY@36..37 "}" + "###); } #[test] fn break_expr() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn foo() { break; @@ -281,24 +1977,132 @@ fn break_expr() { if break 4 { 3; } } "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..91 + FUNCTION_DEF@0..86 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..11 + IDENT@8..11 "foo" + PARAM_LIST@11..13 + L_PAREN@11..12 "(" + R_PAREN@12..13 ")" + WHITESPACE@13..14 " " + BLOCK_EXPR@14..86 + L_CURLY@14..15 "{" + WHITESPACE@15..24 "\n " + EXPR_STMT@24..30 + BREAK_EXPR@24..29 + BREAK_KW@24..29 "break" + SEMI@29..30 ";" + WHITESPACE@30..39 "\n " + EXPR_STMT@39..54 + IF_EXPR@39..54 + IF_KW@39..41 "if" + WHITESPACE@41..42 " " + CONDITION@42..47 + BREAK_EXPR@42..47 + BREAK_KW@42..47 "break" + WHITESPACE@47..48 " " + BLOCK_EXPR@48..54 + L_CURLY@48..49 "{" + WHITESPACE@49..50 " " + EXPR_STMT@50..52 + LITERAL@50..51 + INT_NUMBER@50..51 "3" + SEMI@51..52 ";" + WHITESPACE@52..53 " " + R_CURLY@53..54 "}" + WHITESPACE@54..63 "\n " + IF_EXPR@63..80 + IF_KW@63..65 "if" + WHITESPACE@65..66 " " + CONDITION@66..73 + BREAK_EXPR@66..73 + BREAK_KW@66..71 "break" + WHITESPACE@71..72 " " + LITERAL@72..73 + INT_NUMBER@72..73 "4" + WHITESPACE@73..74 " " + BLOCK_EXPR@74..80 + L_CURLY@74..75 "{" + WHITESPACE@75..76 " " + EXPR_STMT@76..78 + LITERAL@76..77 + INT_NUMBER@76..77 "3" + SEMI@77..78 ";" + WHITESPACE@78..79 " " + R_CURLY@79..80 "}" + WHITESPACE@80..85 "\n " + R_CURLY@85..86 "}" + WHITESPACE@86..91 "\n " + "###); } #[test] fn while_expr() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn foo() { while true {}; while { true } {}; } "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..76 + FUNCTION_DEF@0..71 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..11 + IDENT@8..11 "foo" + PARAM_LIST@11..13 + L_PAREN@11..12 "(" + R_PAREN@12..13 ")" + WHITESPACE@13..14 " " + BLOCK_EXPR@14..71 + L_CURLY@14..15 "{" + WHITESPACE@15..24 "\n " + EXPR_STMT@24..38 + WHILE_EXPR@24..37 + WHILE_KW@24..29 "while" + WHITESPACE@29..30 " " + CONDITION@30..34 + LITERAL@30..34 + TRUE_KW@30..34 "true" + WHITESPACE@34..35 " " + BLOCK_EXPR@35..37 + L_CURLY@35..36 "{" + R_CURLY@36..37 "}" + SEMI@37..38 ";" + WHITESPACE@38..47 "\n " + EXPR_STMT@47..65 + WHILE_EXPR@47..64 + WHILE_KW@47..52 "while" + WHITESPACE@52..53 " " + CONDITION@53..61 + BLOCK_EXPR@53..61 + L_CURLY@53..54 "{" + WHITESPACE@54..55 " " + LITERAL@55..59 + TRUE_KW@55..59 "true" + WHITESPACE@59..60 " " + R_CURLY@60..61 "}" + WHITESPACE@61..62 " " + BLOCK_EXPR@62..64 + L_CURLY@62..63 "{" + R_CURLY@63..64 "}" + SEMI@64..65 ";" + WHITESPACE@65..70 "\n " + R_CURLY@70..71 "}" + WHITESPACE@71..76 "\n " + "###); } #[test] fn struct_lit() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn foo() { U; @@ -310,12 +2114,162 @@ fn struct_lit() { T(1.23, 4,) } "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..171 + FUNCTION_DEF@0..166 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..11 + IDENT@8..11 "foo" + PARAM_LIST@11..13 + L_PAREN@11..12 "(" + R_PAREN@12..13 ")" + WHITESPACE@13..14 " " + BLOCK_EXPR@14..166 + L_CURLY@14..15 "{" + WHITESPACE@15..24 "\n " + EXPR_STMT@24..26 + PATH_EXPR@24..25 + PATH@24..25 + PATH_SEGMENT@24..25 + NAME_REF@24..25 + IDENT@24..25 "U" + SEMI@25..26 ";" + WHITESPACE@26..35 "\n " + EXPR_STMT@35..40 + RECORD_LIT@35..39 + PATH_TYPE@35..36 + PATH@35..36 + PATH_SEGMENT@35..36 + NAME_REF@35..36 + IDENT@35..36 "S" + WHITESPACE@36..37 " " + RECORD_FIELD_LIST@37..39 + L_CURLY@37..38 "{" + R_CURLY@38..39 "}" + SEMI@39..40 ";" + WHITESPACE@40..49 "\n " + EXPR_STMT@49..65 + RECORD_LIT@49..64 + PATH_TYPE@49..50 + PATH@49..50 + PATH_SEGMENT@49..50 + NAME_REF@49..50 + IDENT@49..50 "S" + WHITESPACE@50..51 " " + RECORD_FIELD_LIST@51..64 + L_CURLY@51..52 "{" + WHITESPACE@52..53 " " + RECORD_FIELD@53..54 + NAME_REF@53..54 + IDENT@53..54 "x" + COMMA@54..55 "," + WHITESPACE@55..56 " " + RECORD_FIELD@56..61 + NAME_REF@56..57 + IDENT@56..57 "y" + COLON@57..58 ":" + WHITESPACE@58..59 " " + LITERAL@59..61 + INT_NUMBER@59..61 "32" + COMMA@61..62 "," + WHITESPACE@62..63 " " + R_CURLY@63..64 "}" + SEMI@64..65 ";" + WHITESPACE@65..74 "\n " + EXPR_STMT@74..93 + RECORD_LIT@74..92 + PATH_TYPE@74..75 + PATH@74..75 + PATH_SEGMENT@74..75 + NAME_REF@74..75 + IDENT@74..75 "S" + WHITESPACE@75..76 " " + RECORD_FIELD_LIST@76..92 + L_CURLY@76..77 "{" + WHITESPACE@77..78 " " + RECORD_FIELD@78..83 + NAME_REF@78..79 + IDENT@78..79 "x" + COLON@79..80 ":" + WHITESPACE@80..81 " " + LITERAL@81..83 + INT_NUMBER@81..83 "32" + COMMA@83..84 "," + WHITESPACE@84..85 " " + RECORD_FIELD@85..90 + NAME_REF@85..86 + IDENT@85..86 "y" + COLON@86..87 ":" + WHITESPACE@87..88 " " + LITERAL@88..90 + INT_NUMBER@88..90 "64" + WHITESPACE@90..91 " " + R_CURLY@91..92 "}" + SEMI@92..93 ";" + WHITESPACE@93..102 "\n " + EXPR_STMT@102..123 + RECORD_LIT@102..122 + PATH_TYPE@102..113 + PATH@102..113 + PATH_SEGMENT@102..113 + NAME_REF@102..113 + IDENT@102..113 "TupleStruct" + WHITESPACE@113..114 " " + RECORD_FIELD_LIST@114..122 + L_CURLY@114..115 "{" + WHITESPACE@115..116 " " + RECORD_FIELD@116..120 + NAME_REF@116..117 + INT_NUMBER@116..117 "0" + COLON@117..118 ":" + WHITESPACE@118..119 " " + LITERAL@119..120 + INT_NUMBER@119..120 "1" + WHITESPACE@120..121 " " + R_CURLY@121..122 "}" + SEMI@122..123 ";" + WHITESPACE@123..132 "\n " + EXPR_STMT@132..140 + CALL_EXPR@132..139 + PATH_EXPR@132..133 + PATH@132..133 + PATH_SEGMENT@132..133 + NAME_REF@132..133 + IDENT@132..133 "T" + ARG_LIST@133..139 + L_PAREN@133..134 "(" + LITERAL@134..138 + FLOAT_NUMBER@134..138 "1.23" + R_PAREN@138..139 ")" + SEMI@139..140 ";" + WHITESPACE@140..149 "\n " + CALL_EXPR@149..160 + PATH_EXPR@149..150 + PATH@149..150 + PATH_SEGMENT@149..150 + NAME_REF@149..150 + IDENT@149..150 "T" + ARG_LIST@150..160 + L_PAREN@150..151 "(" + LITERAL@151..155 + FLOAT_NUMBER@151..155 "1.23" + COMMA@155..156 "," + WHITESPACE@156..157 " " + LITERAL@157..158 + INT_NUMBER@157..158 "4" + COMMA@158..159 "," + R_PAREN@159..160 ")" + WHITESPACE@160..165 "\n " + R_CURLY@165..166 "}" + WHITESPACE@166..171 "\n " + "###); } #[test] fn struct_field_index() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn main() { foo.a @@ -328,12 +2282,125 @@ fn struct_field_index() { foo.a.0 } "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..177 + FUNCTION_DEF@0..172 + WHITESPACE@0..5 "\n " + FN_KW@5..7 "fn" + WHITESPACE@7..8 " " + NAME@8..12 + IDENT@8..12 "main" + PARAM_LIST@12..14 + L_PAREN@12..13 "(" + R_PAREN@13..14 ")" + WHITESPACE@14..15 " " + BLOCK_EXPR@15..172 + L_CURLY@15..16 "{" + WHITESPACE@16..25 "\n " + EXPR_STMT@25..30 + FIELD_EXPR@25..30 + PATH_EXPR@25..28 + PATH@25..28 + PATH_SEGMENT@25..28 + NAME_REF@25..28 + IDENT@25..28 "foo" + DOT@28..29 "." + NAME_REF@29..30 + IDENT@29..30 "a" + WHITESPACE@30..39 "\n " + EXPR_STMT@39..46 + FIELD_EXPR@39..46 + FIELD_EXPR@39..44 + PATH_EXPR@39..42 + PATH@39..42 + PATH_SEGMENT@39..42 + NAME_REF@39..42 + IDENT@39..42 "foo" + DOT@42..43 "." + NAME_REF@43..44 + IDENT@43..44 "a" + DOT@44..45 "." + NAME_REF@45..46 + IDENT@45..46 "b" + WHITESPACE@46..55 "\n " + EXPR_STMT@55..60 + FIELD_EXPR@55..60 + PATH_EXPR@55..58 + PATH@55..58 + PATH_SEGMENT@55..58 + NAME_REF@55..58 + IDENT@55..58 "foo" + INDEX@58..60 ".0" + WHITESPACE@60..69 "\n " + EXPR_STMT@69..76 + FIELD_EXPR@69..76 + FIELD_EXPR@69..74 + PATH_EXPR@69..72 + PATH@69..72 + PATH_SEGMENT@69..72 + NAME_REF@69..72 + IDENT@69..72 "foo" + INDEX@72..74 ".0" + INDEX@74..76 ".1" + WHITESPACE@76..85 "\n " + EXPR_STMT@85..91 + FIELD_EXPR@85..91 + PATH_EXPR@85..88 + PATH@85..88 + PATH_SEGMENT@85..88 + NAME_REF@85..88 + IDENT@85..88 "foo" + INDEX@88..91 ".10" + WHITESPACE@91..100 "\n " + EXPR_STMT@100..105 + FIELD_EXPR@100..105 + PATH_EXPR@100..103 + PATH@100..103 + PATH_SEGMENT@100..103 + NAME_REF@100..103 + IDENT@100..103 "foo" + INDEX@103..105 ".0" + EXPR_STMT@105..106 + LITERAL@105..106 + INT_NUMBER@105..106 "1" + WHITESPACE@106..108 " " + COMMENT@108..120 "// index: .0" + WHITESPACE@120..129 "\n " + EXPR_STMT@129..134 + FIELD_EXPR@129..134 + PATH_EXPR@129..132 + PATH@129..132 + PATH_SEGMENT@129..132 + NAME_REF@129..132 + IDENT@129..132 "foo" + INDEX@132..134 ".0" + WHITESPACE@134..135 " " + EXPR_STMT@135..136 + LITERAL@135..136 + INT_NUMBER@135..136 "1" + WHITESPACE@136..137 " " + COMMENT@137..150 "// index: .0 " + WHITESPACE@150..159 "\n " + FIELD_EXPR@159..166 + FIELD_EXPR@159..164 + PATH_EXPR@159..162 + PATH@159..162 + PATH_SEGMENT@159..162 + NAME_REF@159..162 + IDENT@159..162 "foo" + DOT@162..163 "." + NAME_REF@163..164 + IDENT@163..164 "a" + INDEX@164..166 ".0" + WHITESPACE@166..171 "\n " + R_CURLY@171..172 "}" + WHITESPACE@172..177 "\n " + "###); } #[test] fn memory_type_specifier() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" struct Foo {}; struct(gc) Baz {}; @@ -341,12 +2408,92 @@ fn memory_type_specifier() { struct() Err1 {}; // error: expected memory type specifier struct(foo) Err2 {}; // error: expected memory type specifier "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..205 + WHITESPACE@0..5 "\n " + STRUCT_DEF@5..19 + STRUCT_KW@5..11 "struct" + WHITESPACE@11..12 " " + NAME@12..15 + IDENT@12..15 "Foo" + WHITESPACE@15..16 " " + RECORD_FIELD_DEF_LIST@16..19 + L_CURLY@16..17 "{" + R_CURLY@17..18 "}" + SEMI@18..19 ";" + WHITESPACE@19..24 "\n " + STRUCT_DEF@24..42 + STRUCT_KW@24..30 "struct" + MEMORY_TYPE_SPECIFIER@30..34 + L_PAREN@30..31 "(" + GC_KW@31..33 "gc" + R_PAREN@33..34 ")" + WHITESPACE@34..35 " " + NAME@35..38 + IDENT@35..38 "Baz" + WHITESPACE@38..39 " " + RECORD_FIELD_DEF_LIST@39..42 + L_CURLY@39..40 "{" + R_CURLY@40..41 "}" + SEMI@41..42 ";" + WHITESPACE@42..47 "\n " + STRUCT_DEF@47..68 + STRUCT_KW@47..53 "struct" + MEMORY_TYPE_SPECIFIER@53..60 + L_PAREN@53..54 "(" + VALUE_KW@54..59 "value" + R_PAREN@59..60 ")" + WHITESPACE@60..61 " " + NAME@61..64 + IDENT@61..64 "Baz" + WHITESPACE@64..65 " " + RECORD_FIELD_DEF_LIST@65..68 + L_CURLY@65..66 "{" + R_CURLY@66..67 "}" + SEMI@67..68 ";" + WHITESPACE@68..73 "\n " + STRUCT_DEF@73..90 + STRUCT_KW@73..79 "struct" + MEMORY_TYPE_SPECIFIER@79..81 + L_PAREN@79..80 "(" + R_PAREN@80..81 ")" + WHITESPACE@81..82 " " + NAME@82..86 + IDENT@82..86 "Err1" + WHITESPACE@86..87 " " + RECORD_FIELD_DEF_LIST@87..90 + L_CURLY@87..88 "{" + R_CURLY@88..89 "}" + SEMI@89..90 ";" + WHITESPACE@90..94 " " + COMMENT@94..134 "// error: expected me ..." + WHITESPACE@134..139 "\n " + STRUCT_DEF@139..159 + STRUCT_KW@139..145 "struct" + MEMORY_TYPE_SPECIFIER@145..150 + L_PAREN@145..146 "(" + ERROR@146..149 + IDENT@146..149 "foo" + R_PAREN@149..150 ")" + WHITESPACE@150..151 " " + NAME@151..155 + IDENT@151..155 "Err2" + WHITESPACE@155..156 " " + RECORD_FIELD_DEF_LIST@156..159 + L_CURLY@156..157 "{" + R_CURLY@157..158 "}" + SEMI@158..159 ";" + WHITESPACE@159..160 " " + COMMENT@160..200 "// error: expected me ..." + WHITESPACE@200..205 "\n " + error Offset(80): expected memory type specifier + error Offset(146): expected memory type specifier + "###); } #[test] fn visibility() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" pub struct Foo {}; pub(package) struct(gc) Baz {}; @@ -354,42 +2501,298 @@ fn visibility() { pub(package) fn bar() {} pub fn baz() {} "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..140 + WHITESPACE@0..5 "\n " + STRUCT_DEF@5..23 + VISIBILITY@5..8 + PUB_KW@5..8 "pub" + WHITESPACE@8..9 " " + STRUCT_KW@9..15 "struct" + WHITESPACE@15..16 " " + NAME@16..19 + IDENT@16..19 "Foo" + WHITESPACE@19..20 " " + RECORD_FIELD_DEF_LIST@20..23 + L_CURLY@20..21 "{" + R_CURLY@21..22 "}" + SEMI@22..23 ";" + WHITESPACE@23..28 "\n " + STRUCT_DEF@28..59 + VISIBILITY@28..40 + PUB_KW@28..31 "pub" + L_PAREN@31..32 "(" + PACKAGE_KW@32..39 "package" + R_PAREN@39..40 ")" + WHITESPACE@40..41 " " + STRUCT_KW@41..47 "struct" + MEMORY_TYPE_SPECIFIER@47..51 + L_PAREN@47..48 "(" + GC_KW@48..50 "gc" + R_PAREN@50..51 ")" + WHITESPACE@51..52 " " + NAME@52..55 + IDENT@52..55 "Baz" + WHITESPACE@55..56 " " + RECORD_FIELD_DEF_LIST@56..59 + L_CURLY@56..57 "{" + R_CURLY@57..58 "}" + SEMI@58..59 ";" + FUNCTION_DEF@59..86 + WHITESPACE@59..64 "\n " + VISIBILITY@64..74 + PUB_KW@64..67 "pub" + L_PAREN@67..68 "(" + SUPER_KW@68..73 "super" + R_PAREN@73..74 ")" + WHITESPACE@74..75 " " + FN_KW@75..77 "fn" + WHITESPACE@77..78 " " + NAME@78..81 + IDENT@78..81 "foo" + PARAM_LIST@81..83 + L_PAREN@81..82 "(" + R_PAREN@82..83 ")" + WHITESPACE@83..84 " " + BLOCK_EXPR@84..86 + L_CURLY@84..85 "{" + R_CURLY@85..86 "}" + FUNCTION_DEF@86..115 + WHITESPACE@86..91 "\n " + VISIBILITY@91..103 + PUB_KW@91..94 "pub" + L_PAREN@94..95 "(" + PACKAGE_KW@95..102 "package" + R_PAREN@102..103 ")" + WHITESPACE@103..104 " " + FN_KW@104..106 "fn" + WHITESPACE@106..107 " " + NAME@107..110 + IDENT@107..110 "bar" + PARAM_LIST@110..112 + L_PAREN@110..111 "(" + R_PAREN@111..112 ")" + WHITESPACE@112..113 " " + BLOCK_EXPR@113..115 + L_CURLY@113..114 "{" + R_CURLY@114..115 "}" + FUNCTION_DEF@115..135 + WHITESPACE@115..120 "\n " + VISIBILITY@120..123 + PUB_KW@120..123 "pub" + WHITESPACE@123..124 " " + FN_KW@124..126 "fn" + WHITESPACE@126..127 " " + NAME@127..130 + IDENT@127..130 "baz" + PARAM_LIST@130..132 + L_PAREN@130..131 "(" + R_PAREN@131..132 ")" + WHITESPACE@132..133 " " + BLOCK_EXPR@133..135 + L_CURLY@133..134 "{" + R_CURLY@134..135 "}" + WHITESPACE@135..140 "\n " + "###); } #[test] fn extern_fn() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" pub extern fn foo(); "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..30 + FUNCTION_DEF@0..25 + WHITESPACE@0..5 "\n " + VISIBILITY@5..8 + PUB_KW@5..8 "pub" + WHITESPACE@8..9 " " + EXTERN@9..15 + EXTERN_KW@9..15 "extern" + WHITESPACE@15..16 " " + FN_KW@16..18 "fn" + WHITESPACE@18..19 " " + NAME@19..22 + IDENT@19..22 "foo" + PARAM_LIST@22..24 + L_PAREN@22..23 "(" + R_PAREN@23..24 ")" + SEMI@24..25 ";" + WHITESPACE@25..30 "\n " + "###); } #[test] fn type_alias_def() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" type Foo = i32; type Bar = Foo; "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..45 + WHITESPACE@0..5 "\n " + TYPE_ALIAS_DEF@5..20 + TYPE_KW@5..9 "type" + WHITESPACE@9..10 " " + NAME@10..13 + IDENT@10..13 "Foo" + WHITESPACE@13..14 " " + EQ@14..15 "=" + WHITESPACE@15..16 " " + PATH_TYPE@16..19 + PATH@16..19 + PATH_SEGMENT@16..19 + NAME_REF@16..19 + IDENT@16..19 "i32" + SEMI@19..20 ";" + WHITESPACE@20..25 "\n " + TYPE_ALIAS_DEF@25..40 + TYPE_KW@25..29 "type" + WHITESPACE@29..30 " " + NAME@30..33 + IDENT@30..33 "Bar" + WHITESPACE@33..34 " " + EQ@34..35 "=" + WHITESPACE@35..36 " " + PATH_TYPE@36..39 + PATH@36..39 + PATH_SEGMENT@36..39 + NAME_REF@36..39 + IDENT@36..39 "Foo" + SEMI@39..40 ";" + WHITESPACE@40..45 "\n " + "###); } #[test] fn function_return_path() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" fn main() -> self::Foo {} fn main1() -> super::Foo {} fn main2() -> package::Foo {} fn main3() -> package::foo::Foo {} "#, - ); + ).debug_dump(), @r###" + SOURCE_FILE@0..156 + FUNCTION_DEF@0..34 + WHITESPACE@0..9 "\n " + FN_KW@9..11 "fn" + WHITESPACE@11..12 " " + NAME@12..16 + IDENT@12..16 "main" + PARAM_LIST@16..18 + L_PAREN@16..17 "(" + R_PAREN@17..18 ")" + WHITESPACE@18..19 " " + RET_TYPE@19..31 + THIN_ARROW@19..21 "->" + WHITESPACE@21..22 " " + PATH_TYPE@22..31 + PATH@22..31 + PATH@22..26 + PATH_SEGMENT@22..26 + SELF_KW@22..26 "self" + COLONCOLON@26..28 "::" + PATH_SEGMENT@28..31 + NAME_REF@28..31 + IDENT@28..31 "Foo" + WHITESPACE@31..32 " " + BLOCK_EXPR@32..34 + L_CURLY@32..33 "{" + R_CURLY@33..34 "}" + FUNCTION_DEF@34..70 + WHITESPACE@34..43 "\n " + FN_KW@43..45 "fn" + WHITESPACE@45..46 " " + NAME@46..51 + IDENT@46..51 "main1" + PARAM_LIST@51..53 + L_PAREN@51..52 "(" + R_PAREN@52..53 ")" + WHITESPACE@53..54 " " + RET_TYPE@54..67 + THIN_ARROW@54..56 "->" + WHITESPACE@56..57 " " + PATH_TYPE@57..67 + PATH@57..67 + PATH@57..62 + PATH_SEGMENT@57..62 + SUPER_KW@57..62 "super" + COLONCOLON@62..64 "::" + PATH_SEGMENT@64..67 + NAME_REF@64..67 + IDENT@64..67 "Foo" + WHITESPACE@67..68 " " + BLOCK_EXPR@68..70 + L_CURLY@68..69 "{" + R_CURLY@69..70 "}" + FUNCTION_DEF@70..108 + WHITESPACE@70..79 "\n " + FN_KW@79..81 "fn" + WHITESPACE@81..82 " " + NAME@82..87 + IDENT@82..87 "main2" + PARAM_LIST@87..89 + L_PAREN@87..88 "(" + R_PAREN@88..89 ")" + WHITESPACE@89..90 " " + RET_TYPE@90..105 + THIN_ARROW@90..92 "->" + WHITESPACE@92..93 " " + PATH_TYPE@93..105 + PATH@93..105 + PATH@93..100 + PATH_SEGMENT@93..100 + PACKAGE_KW@93..100 "package" + COLONCOLON@100..102 "::" + PATH_SEGMENT@102..105 + NAME_REF@102..105 + IDENT@102..105 "Foo" + WHITESPACE@105..106 " " + BLOCK_EXPR@106..108 + L_CURLY@106..107 "{" + R_CURLY@107..108 "}" + FUNCTION_DEF@108..151 + WHITESPACE@108..117 "\n " + FN_KW@117..119 "fn" + WHITESPACE@119..120 " " + NAME@120..125 + IDENT@120..125 "main3" + PARAM_LIST@125..127 + L_PAREN@125..126 "(" + R_PAREN@126..127 ")" + WHITESPACE@127..128 " " + RET_TYPE@128..148 + THIN_ARROW@128..130 "->" + WHITESPACE@130..131 " " + PATH_TYPE@131..148 + PATH@131..148 + PATH@131..143 + PATH@131..138 + PATH_SEGMENT@131..138 + PACKAGE_KW@131..138 "package" + COLONCOLON@138..140 "::" + PATH_SEGMENT@140..143 + NAME_REF@140..143 + IDENT@140..143 "foo" + COLONCOLON@143..145 "::" + PATH_SEGMENT@145..148 + NAME_REF@145..148 + IDENT@145..148 "Foo" + WHITESPACE@148..149 " " + BLOCK_EXPR@149..151 + L_CURLY@149..150 "{" + R_CURLY@150..151 "}" + WHITESPACE@151..156 "\n " + "###); } #[test] fn use_() { - snapshot_test( + insta::assert_snapshot!(SourceFile::parse( r#" // Simple paths use package_name; @@ -419,5 +2822,337 @@ fn use_() { }; use Foo as _; "#, - ) + ).debug_dump(), @r###" + SOURCE_FILE@0..726 + WHITESPACE@0..9 "\n " + COMMENT@9..24 "// Simple paths" + WHITESPACE@24..33 "\n " + USE@33..50 + USE_KW@33..36 "use" + WHITESPACE@36..37 " " + USE_TREE@37..49 + PATH@37..49 + PATH_SEGMENT@37..49 + NAME_REF@37..49 + IDENT@37..49 "package_name" + SEMI@49..50 ";" + WHITESPACE@50..59 "\n " + USE@59..99 + USE_KW@59..62 "use" + WHITESPACE@62..63 " " + USE_TREE@63..98 + PATH@63..98 + PATH@63..67 + PATH_SEGMENT@63..67 + SELF_KW@63..67 "self" + COLONCOLON@67..69 "::" + PATH_SEGMENT@69..98 + NAME_REF@69..98 + IDENT@69..98 "item_in_scope_or_pack ..." + SEMI@98..99 ";" + WHITESPACE@99..108 "\n " + USE@108..131 + USE_KW@108..111 "use" + WHITESPACE@111..112 " " + USE_TREE@112..130 + PATH@112..130 + PATH@112..124 + PATH@112..116 + PATH_SEGMENT@112..116 + SELF_KW@112..116 "self" + COLONCOLON@116..118 "::" + PATH_SEGMENT@118..124 + NAME_REF@118..124 + IDENT@118..124 "module" + COLONCOLON@124..126 "::" + PATH_SEGMENT@126..130 + NAME_REF@126..130 + IDENT@126..130 "Item" + SEMI@130..131 ";" + WHITESPACE@131..140 "\n " + USE@140..158 + USE_KW@140..143 "use" + WHITESPACE@143..144 " " + USE_TREE@144..157 + PATH@144..157 + PATH@144..151 + PATH_SEGMENT@144..151 + PACKAGE_KW@144..151 "package" + COLONCOLON@151..153 "::" + PATH_SEGMENT@153..157 + NAME_REF@153..157 + IDENT@153..157 "Item" + SEMI@157..158 ";" + WHITESPACE@158..167 "\n " + USE@167..190 + USE_KW@167..170 "use" + WHITESPACE@170..171 " " + USE_TREE@171..189 + PATH@171..189 + PATH@171..181 + PATH@171..175 + PATH_SEGMENT@171..175 + SELF_KW@171..175 "self" + COLONCOLON@175..177 "::" + PATH_SEGMENT@177..181 + NAME_REF@177..181 + IDENT@177..181 "some" + COLONCOLON@181..183 "::" + PATH_SEGMENT@183..189 + NAME_REF@183..189 + IDENT@183..189 "Struct" + SEMI@189..190 ";" + WHITESPACE@190..199 "\n " + USE@199..222 + USE_KW@199..202 "use" + WHITESPACE@202..203 " " + USE_TREE@203..221 + PATH@203..221 + PATH@203..210 + PATH_SEGMENT@203..210 + PACKAGE_KW@203..210 "package" + COLONCOLON@210..212 "::" + PATH_SEGMENT@212..221 + NAME_REF@212..221 + IDENT@212..221 "some_item" + SEMI@221..222 ";" + WHITESPACE@222..232 "\n\n " + COMMENT@232..248 "// Use tree list" + WHITESPACE@248..257 "\n " + USE@257..275 + USE_KW@257..260 "use" + WHITESPACE@260..261 " " + USE_TREE@261..274 + PATH@261..266 + PATH_SEGMENT@261..266 + NAME_REF@261..266 + IDENT@261..266 "crate" + COLONCOLON@266..268 "::" + USE_TREE_LIST@268..274 + L_CURLY@268..269 "{" + USE_TREE@269..273 + PATH@269..273 + PATH_SEGMENT@269..273 + NAME_REF@269..273 + IDENT@269..273 "Item" + R_CURLY@273..274 "}" + SEMI@274..275 ";" + WHITESPACE@275..284 "\n " + USE@284..301 + USE_KW@284..287 "use" + WHITESPACE@287..288 " " + USE_TREE@288..300 + PATH@288..292 + PATH_SEGMENT@288..292 + SELF_KW@288..292 "self" + COLONCOLON@292..294 "::" + USE_TREE_LIST@294..300 + L_CURLY@294..295 "{" + USE_TREE@295..299 + PATH@295..299 + PATH_SEGMENT@295..299 + NAME_REF@295..299 + IDENT@295..299 "Item" + R_CURLY@299..300 "}" + SEMI@300..301 ";" + WHITESPACE@301..311 "\n\n " + COMMENT@311..329 "// Wildcard import" + WHITESPACE@329..338 "\n " + USE@338..344 + USE_KW@338..341 "use" + WHITESPACE@341..342 " " + ERROR@342..343 + STAR@342..343 "*" + SEMI@343..344 ";" + WHITESPACE@344..345 " " + COMMENT@345..353 "// Error" + WHITESPACE@353..362 "\n " + USE@362..367 + USE_KW@362..365 "use" + WHITESPACE@365..366 " " + ERROR@366..367 + COLON@366..367 ":" + ERROR@367..368 + COLON@367..368 ":" + ERROR@368..369 + STAR@368..369 "*" + ERROR@369..370 + SEMI@369..370 ";" + WHITESPACE@370..371 " " + COMMENT@371..379 "// Error" + WHITESPACE@379..388 "\n " + USE@388..401 + USE_KW@388..391 "use" + WHITESPACE@391..392 " " + USE_TREE@392..400 + PATH@392..397 + PATH_SEGMENT@392..397 + NAME_REF@392..397 + IDENT@392..397 "crate" + COLONCOLON@397..399 "::" + STAR@399..400 "*" + SEMI@400..401 ";" + WHITESPACE@401..410 "\n " + USE@410..425 + USE_KW@410..413 "use" + WHITESPACE@413..414 " " + USE_TREE@414..424 + PATH@414..419 + PATH_SEGMENT@414..419 + NAME_REF@414..419 + IDENT@414..419 "crate" + COLONCOLON@419..421 "::" + USE_TREE_LIST@421..424 + L_CURLY@421..422 "{" + USE_TREE@422..423 + STAR@422..423 "*" + R_CURLY@423..424 "}" + SEMI@424..425 ";" + WHITESPACE@425..435 "\n\n " + COMMENT@435..445 "// Renames" + WHITESPACE@445..454 "\n " + USE@454..482 + USE_KW@454..457 "use" + WHITESPACE@457..458 " " + USE_TREE@458..481 + PATH@458..468 + PATH@458..462 + PATH_SEGMENT@458..462 + NAME_REF@458..462 + IDENT@458..462 "some" + COLONCOLON@462..464 "::" + PATH_SEGMENT@464..468 + NAME_REF@464..468 + IDENT@464..468 "path" + WHITESPACE@468..469 " " + RENAME@469..481 + AS_KW@469..471 "as" + WHITESPACE@471..472 " " + NAME@472..481 + IDENT@472..481 "some_name" + SEMI@481..482 ";" + WHITESPACE@482..491 "\n " + USE@491..695 + USE_KW@491..494 "use" + WHITESPACE@494..495 " " + USE_TREE@495..694 + PATH@495..499 + PATH_SEGMENT@495..499 + NAME_REF@495..499 + IDENT@495..499 "some" + COLONCOLON@499..501 "::" + USE_TREE_LIST@501..694 + L_CURLY@501..502 "{" + WHITESPACE@502..515 "\n " + USE_TREE@515..545 + PATH@515..526 + PATH@515..520 + PATH_SEGMENT@515..520 + NAME_REF@515..520 + IDENT@515..520 "other" + COLONCOLON@520..522 "::" + PATH_SEGMENT@522..526 + NAME_REF@522..526 + IDENT@522..526 "path" + WHITESPACE@526..527 " " + RENAME@527..545 + AS_KW@527..529 "as" + WHITESPACE@529..530 " " + NAME@530..545 + IDENT@530..545 "some_other_name" + COMMA@545..546 "," + WHITESPACE@546..559 "\n " + USE_TREE@559..592 + PATH@559..574 + PATH@559..568 + PATH_SEGMENT@559..568 + NAME_REF@559..568 + IDENT@559..568 "different" + COLONCOLON@568..570 "::" + PATH_SEGMENT@570..574 + NAME_REF@570..574 + IDENT@570..574 "path" + WHITESPACE@574..575 " " + RENAME@575..592 + AS_KW@575..577 "as" + WHITESPACE@577..578 " " + NAME@578..592 + IDENT@578..592 "different_name" + COMMA@592..593 "," + WHITESPACE@593..606 "\n " + USE_TREE@606..624 + PATH@606..624 + PATH@606..618 + PATH@606..609 + PATH_SEGMENT@606..609 + NAME_REF@606..609 + IDENT@606..609 "yet" + COLONCOLON@609..611 "::" + PATH_SEGMENT@611..618 + NAME_REF@611..618 + IDENT@611..618 "another" + COLONCOLON@618..620 "::" + PATH_SEGMENT@620..624 + NAME_REF@620..624 + IDENT@620..624 "path" + COMMA@624..625 "," + WHITESPACE@625..638 "\n " + USE_TREE@638..684 + PATH@638..681 + PATH@638..670 + PATH@638..664 + PATH@638..654 + PATH@638..650 + PATH@638..645 + PATH_SEGMENT@638..645 + NAME_REF@638..645 + IDENT@638..645 "running" + COLONCOLON@645..647 "::" + PATH_SEGMENT@647..650 + NAME_REF@647..650 + IDENT@647..650 "out" + COLONCOLON@650..652 "::" + PATH_SEGMENT@652..654 + NAME_REF@652..654 + IDENT@652..654 "of" + COLONCOLON@654..656 "::" + PATH_SEGMENT@656..664 + NAME_REF@656..664 + IDENT@656..664 "synonyms" + COLONCOLON@664..666 "::" + PATH_SEGMENT@666..670 + NAME_REF@666..670 + IDENT@666..670 "for_" + COLONCOLON@670..672 "::" + PATH_SEGMENT@672..681 + NAME_REF@672..681 + IDENT@672..681 "different" + COLONCOLON@681..683 "::" + STAR@683..684 "*" + WHITESPACE@684..693 "\n " + R_CURLY@693..694 "}" + SEMI@694..695 ";" + WHITESPACE@695..704 "\n " + USE@704..717 + USE_KW@704..707 "use" + WHITESPACE@707..708 " " + USE_TREE@708..716 + PATH@708..711 + PATH_SEGMENT@708..711 + NAME_REF@708..711 + IDENT@708..711 "Foo" + WHITESPACE@711..712 " " + RENAME@712..716 + AS_KW@712..714 "as" + WHITESPACE@714..715 " " + UNDERSCORE@715..716 "_" + SEMI@716..717 ";" + WHITESPACE@717..726 "\n " + error Offset(342): expected one of `self`, `super`, `package` or an identifier + error Offset(366): expected one of `self`, `super`, `package` or an identifier + error Offset(367): expected SEMI + error Offset(367): expected a declaration + error Offset(368): expected a declaration + error Offset(369): expected a declaration + "###); } diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__binary_cmp.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__binary_cmp.snap deleted file mode 100644 index bc4813a9f..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__binary_cmp.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/lexer.rs -expression: "a==b\na ==b\na== b\na == b" ---- -IDENT 1 "a" -EQ 1 "=" -EQ 1 "=" -IDENT 1 "b" -WHITESPACE 1 "\n" -IDENT 1 "a" -WHITESPACE 1 " " -EQ 1 "=" -EQ 1 "=" -IDENT 1 "b" -WHITESPACE 1 "\n" -IDENT 1 "a" -EQ 1 "=" -EQ 1 "=" -WHITESPACE 1 " " -IDENT 1 "b" -WHITESPACE 1 "\n" -IDENT 1 "a" -WHITESPACE 1 " " -EQ 1 "=" -EQ 1 "=" -WHITESPACE 1 " " -IDENT 1 "b" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__comments.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__comments.snap deleted file mode 100644 index 57db7f49a..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__comments.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/lexer.rs -expression: "// hello, world!\n/**/\n/* block comment */\n/* multi\n line\n comment */\n/* /* nested */ */\n/* unclosed comment" ---- -COMMENT 16 "// hello, world!" -WHITESPACE 1 "\n" -COMMENT 4 "/**/" -WHITESPACE 1 "\n" -COMMENT 19 "/* block comment */" -WHITESPACE 1 "\n" -COMMENT 30 "/* multi\n line\n comment */" -WHITESPACE 1 "\n" -COMMENT 18 "/* /* nested */ */" -WHITESPACE 1 "\n" -COMMENT 19 "/* unclosed comment" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__ident.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__ident.snap deleted file mode 100644 index 4e5359b5c..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__ident.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/lexer.rs -expression: hello world_ _a2 _ __ x 即可编著课程 ---- -IDENT 5 "hello" -WHITESPACE 1 " " -IDENT 6 "world_" -WHITESPACE 1 " " -IDENT 3 "_a2" -WHITESPACE 1 " " -UNDERSCORE 1 "_" -WHITESPACE 1 " " -IDENT 2 "__" -WHITESPACE 1 " " -IDENT 1 "x" -WHITESPACE 1 " " -IDENT 18 "即可编著课程" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__keywords.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__keywords.snap deleted file mode 100644 index 0eb40602c..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__keywords.snap +++ /dev/null @@ -1,50 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/lexer.rs -expression: "break do else false for fn if in nil\nreturn true while let mut struct class\nnever loop pub super self package type" ---- -BREAK_KW 5 "break" -WHITESPACE 1 " " -DO_KW 2 "do" -WHITESPACE 1 " " -ELSE_KW 4 "else" -WHITESPACE 1 " " -FALSE_KW 5 "false" -WHITESPACE 1 " " -FOR_KW 3 "for" -WHITESPACE 1 " " -FN_KW 2 "fn" -WHITESPACE 1 " " -IF_KW 2 "if" -WHITESPACE 1 " " -IN_KW 2 "in" -WHITESPACE 1 " " -NIL_KW 3 "nil" -WHITESPACE 1 "\n" -RETURN_KW 6 "return" -WHITESPACE 1 " " -TRUE_KW 4 "true" -WHITESPACE 1 " " -WHILE_KW 5 "while" -WHITESPACE 1 " " -LET_KW 3 "let" -WHITESPACE 1 " " -MUT_KW 3 "mut" -WHITESPACE 1 " " -STRUCT_KW 6 "struct" -WHITESPACE 1 " " -CLASS_KW 5 "class" -WHITESPACE 1 "\n" -NEVER_KW 5 "never" -WHITESPACE 1 " " -LOOP_KW 4 "loop" -WHITESPACE 1 " " -PUB_KW 3 "pub" -WHITESPACE 1 " " -SUPER_KW 5 "super" -WHITESPACE 1 " " -SELF_KW 4 "self" -WHITESPACE 1 " " -PACKAGE_KW 7 "package" -WHITESPACE 1 " " -TYPE_KW 4 "type" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__numbers.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__numbers.snap deleted file mode 100644 index a036761a0..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__numbers.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/lexer.rs -expression: "1.34\n0x3Af\n1e-3\n100_000\n0x3a_u32\n1f32\n0o71234" ---- -FLOAT_NUMBER 4 "1.34" -WHITESPACE 1 "\n" -INT_NUMBER 5 "0x3Af" -WHITESPACE 1 "\n" -FLOAT_NUMBER 4 "1e-3" -WHITESPACE 1 "\n" -INT_NUMBER 7 "100_000" -WHITESPACE 1 "\n" -INT_NUMBER 8 "0x3a_u32" -WHITESPACE 1 "\n" -INT_NUMBER 4 "1f32" -WHITESPACE 1 "\n" -INT_NUMBER 7 "0o71234" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__strings.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__strings.snap deleted file mode 100644 index 94ea4f704..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__strings.snap +++ /dev/null @@ -1,14 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/lexer.rs -expression: "\"Hello, world!\"\n'Hello, world!'\n\"\\n\"\n\"\\\"\\\\\"\n\"multi\nline\"" ---- -STRING 15 "\"Hello, world!\"" -WHITESPACE 1 "\n" -STRING 15 "'Hello, world!'" -WHITESPACE 1 "\n" -STRING 4 "\"\\n\"" -WHITESPACE 1 "\n" -STRING 6 "\"\\\"\\\\\"" -WHITESPACE 1 "\n" -STRING 12 "\"multi\nline\"" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__symbols.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__symbols.snap deleted file mode 100644 index 8f8702172..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__symbols.snap +++ /dev/null @@ -1,121 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/lexer.rs -expression: "# ( ) { } [ ] ; ,\n= ==\n!=\n< <=\n> >=\n. .. ... ..=\n+ +=\n- -=\n* *=\n/ /=\n% %=\n<< <<=\n>> >>=\n&& & &=\n|| | |=\n^ ^=\n: ::\n->" ---- -HASH 1 "#" -WHITESPACE 1 " " -L_PAREN 1 "(" -WHITESPACE 1 " " -R_PAREN 1 ")" -WHITESPACE 1 " " -L_CURLY 1 "{" -WHITESPACE 1 " " -R_CURLY 1 "}" -WHITESPACE 1 " " -L_BRACKET 1 "[" -WHITESPACE 1 " " -R_BRACKET 1 "]" -WHITESPACE 1 " " -SEMI 1 ";" -WHITESPACE 1 " " -COMMA 1 "," -WHITESPACE 1 "\n" -EQ 1 "=" -WHITESPACE 1 " " -EQ 1 "=" -EQ 1 "=" -WHITESPACE 1 "\n" -EXCLAMATION 1 "!" -EQ 1 "=" -WHITESPACE 1 "\n" -LT 1 "<" -WHITESPACE 1 " " -LT 1 "<" -EQ 1 "=" -WHITESPACE 1 "\n" -GT 1 ">" -WHITESPACE 1 " " -GT 1 ">" -EQ 1 "=" -WHITESPACE 1 "\n" -DOT 1 "." -WHITESPACE 1 " " -DOT 1 "." -DOT 1 "." -WHITESPACE 1 " " -DOT 1 "." -DOT 1 "." -DOT 1 "." -WHITESPACE 1 " " -DOT 1 "." -DOT 1 "." -EQ 1 "=" -WHITESPACE 1 "\n" -PLUS 1 "+" -WHITESPACE 1 " " -PLUS 1 "+" -EQ 1 "=" -WHITESPACE 1 "\n" -MINUS 1 "-" -WHITESPACE 1 " " -MINUS 1 "-" -EQ 1 "=" -WHITESPACE 1 "\n" -STAR 1 "*" -WHITESPACE 1 " " -STAR 1 "*" -EQ 1 "=" -WHITESPACE 1 "\n" -SLASH 1 "/" -WHITESPACE 1 " " -SLASH 1 "/" -EQ 1 "=" -WHITESPACE 1 "\n" -PERCENT 1 "%" -WHITESPACE 1 " " -PERCENT 1 "%" -EQ 1 "=" -WHITESPACE 1 "\n" -LT 1 "<" -LT 1 "<" -WHITESPACE 1 " " -LT 1 "<" -LT 1 "<" -EQ 1 "=" -WHITESPACE 1 "\n" -GT 1 ">" -GT 1 ">" -WHITESPACE 1 " " -GT 1 ">" -GT 1 ">" -EQ 1 "=" -WHITESPACE 1 "\n" -AMP 1 "&" -AMP 1 "&" -WHITESPACE 1 " " -AMP 1 "&" -WHITESPACE 1 " " -AMP 1 "&" -EQ 1 "=" -WHITESPACE 1 "\n" -PIPE 1 "|" -PIPE 1 "|" -WHITESPACE 1 " " -PIPE 1 "|" -WHITESPACE 1 " " -PIPE 1 "|" -EQ 1 "=" -WHITESPACE 1 "\n" -CARET 1 "^" -WHITESPACE 1 " " -CARET 1 "^" -EQ 1 "=" -WHITESPACE 1 "\n" -COLON 1 ":" -WHITESPACE 1 " " -COLON 1 ":" -COLON 1 ":" -WHITESPACE 1 "\n" -MINUS 1 "-" -GT 1 ">" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__unclosed_string.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__unclosed_string.snap deleted file mode 100644 index 086d15bdb..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__unclosed_string.snap +++ /dev/null @@ -1,6 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/lexer.rs -expression: "\"test" ---- -STRING 5 "\"test" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__whitespace.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__whitespace.snap deleted file mode 100644 index 89e789034..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__lexer__whitespace.snap +++ /dev/null @@ -1,22 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/lexer.rs -expression: "h e ll o\nw\n\no r l d" ---- -IDENT 1 "h" -WHITESPACE 1 " " -IDENT 1 "e" -WHITESPACE 1 " " -IDENT 2 "ll" -WHITESPACE 2 " " -IDENT 1 "o" -WHITESPACE 1 "\n" -IDENT 1 "w" -WHITESPACE 2 "\n\n" -IDENT 1 "o" -WHITESPACE 1 " " -IDENT 1 "r" -WHITESPACE 5 " " -IDENT 1 "l" -WHITESPACE 3 " " -IDENT 1 "d" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__arithmetic_operands.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__arithmetic_operands.snap deleted file mode 100644 index 0bcaf00c7..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__arithmetic_operands.snap +++ /dev/null @@ -1,259 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn main() {\n let _ = a + b;\n let _ = a - b;\n let _ = a * b;\n let _ = a / b;\n let _ = a % b;\n let _ = a << b;\n let _ = a >> b;\n let _ = a & b;\n let _ = a | b;\n let _ = a ^ b;\n}" ---- -SOURCE_FILE@0..205 - FUNCTION_DEF@0..205 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..7 - IDENT@3..7 "main" - PARAM_LIST@7..9 - L_PAREN@7..8 "(" - R_PAREN@8..9 ")" - WHITESPACE@9..10 " " - BLOCK_EXPR@10..205 - L_CURLY@10..11 "{" - WHITESPACE@11..16 "\n " - LET_STMT@16..30 - LET_KW@16..19 "let" - WHITESPACE@19..20 " " - PLACEHOLDER_PAT@20..21 - UNDERSCORE@20..21 "_" - WHITESPACE@21..22 " " - EQ@22..23 "=" - WHITESPACE@23..24 " " - BIN_EXPR@24..29 - PATH_EXPR@24..25 - PATH@24..25 - PATH_SEGMENT@24..25 - NAME_REF@24..25 - IDENT@24..25 "a" - WHITESPACE@25..26 " " - PLUS@26..27 "+" - WHITESPACE@27..28 " " - PATH_EXPR@28..29 - PATH@28..29 - PATH_SEGMENT@28..29 - NAME_REF@28..29 - IDENT@28..29 "b" - SEMI@29..30 ";" - WHITESPACE@30..35 "\n " - LET_STMT@35..49 - LET_KW@35..38 "let" - WHITESPACE@38..39 " " - PLACEHOLDER_PAT@39..40 - UNDERSCORE@39..40 "_" - WHITESPACE@40..41 " " - EQ@41..42 "=" - WHITESPACE@42..43 " " - BIN_EXPR@43..48 - PATH_EXPR@43..44 - PATH@43..44 - PATH_SEGMENT@43..44 - NAME_REF@43..44 - IDENT@43..44 "a" - WHITESPACE@44..45 " " - MINUS@45..46 "-" - WHITESPACE@46..47 " " - PATH_EXPR@47..48 - PATH@47..48 - PATH_SEGMENT@47..48 - NAME_REF@47..48 - IDENT@47..48 "b" - SEMI@48..49 ";" - WHITESPACE@49..54 "\n " - LET_STMT@54..68 - LET_KW@54..57 "let" - WHITESPACE@57..58 " " - PLACEHOLDER_PAT@58..59 - UNDERSCORE@58..59 "_" - WHITESPACE@59..60 " " - EQ@60..61 "=" - WHITESPACE@61..62 " " - BIN_EXPR@62..67 - PATH_EXPR@62..63 - PATH@62..63 - PATH_SEGMENT@62..63 - NAME_REF@62..63 - IDENT@62..63 "a" - WHITESPACE@63..64 " " - STAR@64..65 "*" - WHITESPACE@65..66 " " - PATH_EXPR@66..67 - PATH@66..67 - PATH_SEGMENT@66..67 - NAME_REF@66..67 - IDENT@66..67 "b" - SEMI@67..68 ";" - WHITESPACE@68..73 "\n " - LET_STMT@73..87 - LET_KW@73..76 "let" - WHITESPACE@76..77 " " - PLACEHOLDER_PAT@77..78 - UNDERSCORE@77..78 "_" - WHITESPACE@78..79 " " - EQ@79..80 "=" - WHITESPACE@80..81 " " - BIN_EXPR@81..86 - PATH_EXPR@81..82 - PATH@81..82 - PATH_SEGMENT@81..82 - NAME_REF@81..82 - IDENT@81..82 "a" - WHITESPACE@82..83 " " - SLASH@83..84 "/" - WHITESPACE@84..85 " " - PATH_EXPR@85..86 - PATH@85..86 - PATH_SEGMENT@85..86 - NAME_REF@85..86 - IDENT@85..86 "b" - SEMI@86..87 ";" - WHITESPACE@87..92 "\n " - LET_STMT@92..106 - LET_KW@92..95 "let" - WHITESPACE@95..96 " " - PLACEHOLDER_PAT@96..97 - UNDERSCORE@96..97 "_" - WHITESPACE@97..98 " " - EQ@98..99 "=" - WHITESPACE@99..100 " " - BIN_EXPR@100..105 - PATH_EXPR@100..101 - PATH@100..101 - PATH_SEGMENT@100..101 - NAME_REF@100..101 - IDENT@100..101 "a" - WHITESPACE@101..102 " " - PERCENT@102..103 "%" - WHITESPACE@103..104 " " - PATH_EXPR@104..105 - PATH@104..105 - PATH_SEGMENT@104..105 - NAME_REF@104..105 - IDENT@104..105 "b" - SEMI@105..106 ";" - WHITESPACE@106..111 "\n " - LET_STMT@111..126 - LET_KW@111..114 "let" - WHITESPACE@114..115 " " - PLACEHOLDER_PAT@115..116 - UNDERSCORE@115..116 "_" - WHITESPACE@116..117 " " - EQ@117..118 "=" - WHITESPACE@118..119 " " - BIN_EXPR@119..125 - PATH_EXPR@119..120 - PATH@119..120 - PATH_SEGMENT@119..120 - NAME_REF@119..120 - IDENT@119..120 "a" - WHITESPACE@120..121 " " - SHL@121..123 "<<" - WHITESPACE@123..124 " " - PATH_EXPR@124..125 - PATH@124..125 - PATH_SEGMENT@124..125 - NAME_REF@124..125 - IDENT@124..125 "b" - SEMI@125..126 ";" - WHITESPACE@126..131 "\n " - LET_STMT@131..146 - LET_KW@131..134 "let" - WHITESPACE@134..135 " " - PLACEHOLDER_PAT@135..136 - UNDERSCORE@135..136 "_" - WHITESPACE@136..137 " " - EQ@137..138 "=" - WHITESPACE@138..139 " " - BIN_EXPR@139..145 - PATH_EXPR@139..140 - PATH@139..140 - PATH_SEGMENT@139..140 - NAME_REF@139..140 - IDENT@139..140 "a" - WHITESPACE@140..141 " " - SHR@141..143 ">>" - WHITESPACE@143..144 " " - PATH_EXPR@144..145 - PATH@144..145 - PATH_SEGMENT@144..145 - NAME_REF@144..145 - IDENT@144..145 "b" - SEMI@145..146 ";" - WHITESPACE@146..151 "\n " - LET_STMT@151..165 - LET_KW@151..154 "let" - WHITESPACE@154..155 " " - PLACEHOLDER_PAT@155..156 - UNDERSCORE@155..156 "_" - WHITESPACE@156..157 " " - EQ@157..158 "=" - WHITESPACE@158..159 " " - BIN_EXPR@159..164 - PATH_EXPR@159..160 - PATH@159..160 - PATH_SEGMENT@159..160 - NAME_REF@159..160 - IDENT@159..160 "a" - WHITESPACE@160..161 " " - AMP@161..162 "&" - WHITESPACE@162..163 " " - PATH_EXPR@163..164 - PATH@163..164 - PATH_SEGMENT@163..164 - NAME_REF@163..164 - IDENT@163..164 "b" - SEMI@164..165 ";" - WHITESPACE@165..170 "\n " - LET_STMT@170..184 - LET_KW@170..173 "let" - WHITESPACE@173..174 " " - PLACEHOLDER_PAT@174..175 - UNDERSCORE@174..175 "_" - WHITESPACE@175..176 " " - EQ@176..177 "=" - WHITESPACE@177..178 " " - BIN_EXPR@178..183 - PATH_EXPR@178..179 - PATH@178..179 - PATH_SEGMENT@178..179 - NAME_REF@178..179 - IDENT@178..179 "a" - WHITESPACE@179..180 " " - PIPE@180..181 "|" - WHITESPACE@181..182 " " - PATH_EXPR@182..183 - PATH@182..183 - PATH_SEGMENT@182..183 - NAME_REF@182..183 - IDENT@182..183 "b" - SEMI@183..184 ";" - WHITESPACE@184..189 "\n " - LET_STMT@189..203 - LET_KW@189..192 "let" - WHITESPACE@192..193 " " - PLACEHOLDER_PAT@193..194 - UNDERSCORE@193..194 "_" - WHITESPACE@194..195 " " - EQ@195..196 "=" - WHITESPACE@196..197 " " - BIN_EXPR@197..202 - PATH_EXPR@197..198 - PATH@197..198 - PATH_SEGMENT@197..198 - NAME_REF@197..198 - IDENT@197..198 "a" - WHITESPACE@198..199 " " - CARET@199..200 "^" - WHITESPACE@200..201 " " - PATH_EXPR@201..202 - PATH@201..202 - PATH_SEGMENT@201..202 - NAME_REF@201..202 - IDENT@201..202 "b" - SEMI@202..203 ";" - WHITESPACE@203..204 "\n" - R_CURLY@204..205 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__assignment_operands.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__assignment_operands.snap deleted file mode 100644 index d9ad8939b..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__assignment_operands.snap +++ /dev/null @@ -1,205 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn main() {\n let a = b;\n a += b;\n a -= b;\n a *= b;\n a /= b;\n a %= b;\n a <<= b;\n a >>= b;\n a &= b;\n a |= b;\n a ^= b;\n}" ---- -SOURCE_FILE@0..150 - FUNCTION_DEF@0..150 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..7 - IDENT@3..7 "main" - PARAM_LIST@7..9 - L_PAREN@7..8 "(" - R_PAREN@8..9 ")" - WHITESPACE@9..10 " " - BLOCK_EXPR@10..150 - L_CURLY@10..11 "{" - WHITESPACE@11..16 "\n " - LET_STMT@16..26 - LET_KW@16..19 "let" - WHITESPACE@19..20 " " - BIND_PAT@20..21 - NAME@20..21 - IDENT@20..21 "a" - WHITESPACE@21..22 " " - EQ@22..23 "=" - WHITESPACE@23..24 " " - PATH_EXPR@24..25 - PATH@24..25 - PATH_SEGMENT@24..25 - NAME_REF@24..25 - IDENT@24..25 "b" - SEMI@25..26 ";" - WHITESPACE@26..31 "\n " - EXPR_STMT@31..38 - BIN_EXPR@31..37 - PATH_EXPR@31..32 - PATH@31..32 - PATH_SEGMENT@31..32 - NAME_REF@31..32 - IDENT@31..32 "a" - WHITESPACE@32..33 " " - PLUSEQ@33..35 "+=" - WHITESPACE@35..36 " " - PATH_EXPR@36..37 - PATH@36..37 - PATH_SEGMENT@36..37 - NAME_REF@36..37 - IDENT@36..37 "b" - SEMI@37..38 ";" - WHITESPACE@38..43 "\n " - EXPR_STMT@43..50 - BIN_EXPR@43..49 - PATH_EXPR@43..44 - PATH@43..44 - PATH_SEGMENT@43..44 - NAME_REF@43..44 - IDENT@43..44 "a" - WHITESPACE@44..45 " " - MINUSEQ@45..47 "-=" - WHITESPACE@47..48 " " - PATH_EXPR@48..49 - PATH@48..49 - PATH_SEGMENT@48..49 - NAME_REF@48..49 - IDENT@48..49 "b" - SEMI@49..50 ";" - WHITESPACE@50..55 "\n " - EXPR_STMT@55..62 - BIN_EXPR@55..61 - PATH_EXPR@55..56 - PATH@55..56 - PATH_SEGMENT@55..56 - NAME_REF@55..56 - IDENT@55..56 "a" - WHITESPACE@56..57 " " - STAREQ@57..59 "*=" - WHITESPACE@59..60 " " - PATH_EXPR@60..61 - PATH@60..61 - PATH_SEGMENT@60..61 - NAME_REF@60..61 - IDENT@60..61 "b" - SEMI@61..62 ";" - WHITESPACE@62..67 "\n " - EXPR_STMT@67..74 - BIN_EXPR@67..73 - PATH_EXPR@67..68 - PATH@67..68 - PATH_SEGMENT@67..68 - NAME_REF@67..68 - IDENT@67..68 "a" - WHITESPACE@68..69 " " - SLASHEQ@69..71 "/=" - WHITESPACE@71..72 " " - PATH_EXPR@72..73 - PATH@72..73 - PATH_SEGMENT@72..73 - NAME_REF@72..73 - IDENT@72..73 "b" - SEMI@73..74 ";" - WHITESPACE@74..79 "\n " - EXPR_STMT@79..86 - BIN_EXPR@79..85 - PATH_EXPR@79..80 - PATH@79..80 - PATH_SEGMENT@79..80 - NAME_REF@79..80 - IDENT@79..80 "a" - WHITESPACE@80..81 " " - PERCENTEQ@81..83 "%=" - WHITESPACE@83..84 " " - PATH_EXPR@84..85 - PATH@84..85 - PATH_SEGMENT@84..85 - NAME_REF@84..85 - IDENT@84..85 "b" - SEMI@85..86 ";" - WHITESPACE@86..91 "\n " - EXPR_STMT@91..99 - BIN_EXPR@91..98 - PATH_EXPR@91..92 - PATH@91..92 - PATH_SEGMENT@91..92 - NAME_REF@91..92 - IDENT@91..92 "a" - WHITESPACE@92..93 " " - SHLEQ@93..96 "<<=" - WHITESPACE@96..97 " " - PATH_EXPR@97..98 - PATH@97..98 - PATH_SEGMENT@97..98 - NAME_REF@97..98 - IDENT@97..98 "b" - SEMI@98..99 ";" - WHITESPACE@99..104 "\n " - EXPR_STMT@104..112 - BIN_EXPR@104..111 - PATH_EXPR@104..105 - PATH@104..105 - PATH_SEGMENT@104..105 - NAME_REF@104..105 - IDENT@104..105 "a" - WHITESPACE@105..106 " " - SHREQ@106..109 ">>=" - WHITESPACE@109..110 " " - PATH_EXPR@110..111 - PATH@110..111 - PATH_SEGMENT@110..111 - NAME_REF@110..111 - IDENT@110..111 "b" - SEMI@111..112 ";" - WHITESPACE@112..117 "\n " - EXPR_STMT@117..124 - BIN_EXPR@117..123 - PATH_EXPR@117..118 - PATH@117..118 - PATH_SEGMENT@117..118 - NAME_REF@117..118 - IDENT@117..118 "a" - WHITESPACE@118..119 " " - AMPEQ@119..121 "&=" - WHITESPACE@121..122 " " - PATH_EXPR@122..123 - PATH@122..123 - PATH_SEGMENT@122..123 - NAME_REF@122..123 - IDENT@122..123 "b" - SEMI@123..124 ";" - WHITESPACE@124..129 "\n " - EXPR_STMT@129..136 - BIN_EXPR@129..135 - PATH_EXPR@129..130 - PATH@129..130 - PATH_SEGMENT@129..130 - NAME_REF@129..130 - IDENT@129..130 "a" - WHITESPACE@130..131 " " - PIPEEQ@131..133 "|=" - WHITESPACE@133..134 " " - PATH_EXPR@134..135 - PATH@134..135 - PATH_SEGMENT@134..135 - NAME_REF@134..135 - IDENT@134..135 "b" - SEMI@135..136 ";" - WHITESPACE@136..141 "\n " - EXPR_STMT@141..148 - BIN_EXPR@141..147 - PATH_EXPR@141..142 - PATH@141..142 - PATH_SEGMENT@141..142 - NAME_REF@141..142 - IDENT@141..142 "a" - WHITESPACE@142..143 " " - CARETEQ@143..145 "^=" - WHITESPACE@145..146 " " - PATH_EXPR@146..147 - PATH@146..147 - PATH_SEGMENT@146..147 - NAME_REF@146..147 - IDENT@146..147 "b" - SEMI@147..148 ";" - WHITESPACE@148..149 "\n" - R_CURLY@149..150 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__binary_expr.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__binary_expr.snap deleted file mode 100644 index 60ca501fc..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__binary_expr.snap +++ /dev/null @@ -1,63 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn foo() {\n let a = 3+4*5\n let b = 3*4+10/2\n}" ---- -SOURCE_FILE@0..51 - FUNCTION_DEF@0..51 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..6 - IDENT@3..6 "foo" - PARAM_LIST@6..8 - L_PAREN@6..7 "(" - R_PAREN@7..8 ")" - WHITESPACE@8..9 " " - BLOCK_EXPR@9..51 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - LET_STMT@15..28 - LET_KW@15..18 "let" - WHITESPACE@18..19 " " - BIND_PAT@19..20 - NAME@19..20 - IDENT@19..20 "a" - WHITESPACE@20..21 " " - EQ@21..22 "=" - WHITESPACE@22..23 " " - BIN_EXPR@23..28 - LITERAL@23..24 - INT_NUMBER@23..24 "3" - PLUS@24..25 "+" - BIN_EXPR@25..28 - LITERAL@25..26 - INT_NUMBER@25..26 "4" - STAR@26..27 "*" - LITERAL@27..28 - INT_NUMBER@27..28 "5" - WHITESPACE@28..33 "\n " - LET_STMT@33..49 - LET_KW@33..36 "let" - WHITESPACE@36..37 " " - BIND_PAT@37..38 - NAME@37..38 - IDENT@37..38 "b" - WHITESPACE@38..39 " " - EQ@39..40 "=" - WHITESPACE@40..41 " " - BIN_EXPR@41..49 - BIN_EXPR@41..44 - LITERAL@41..42 - INT_NUMBER@41..42 "3" - STAR@42..43 "*" - LITERAL@43..44 - INT_NUMBER@43..44 "4" - PLUS@44..45 "+" - BIN_EXPR@45..49 - LITERAL@45..47 - INT_NUMBER@45..47 "10" - SLASH@47..48 "/" - LITERAL@48..49 - INT_NUMBER@48..49 "2" - WHITESPACE@49..50 "\n" - R_CURLY@50..51 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__block.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__block.snap deleted file mode 100644 index 167338ae4..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__block.snap +++ /dev/null @@ -1,55 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn foo() {\n let a;\n let b:i32;\n let c:string;\n}" ---- -SOURCE_FILE@0..56 - FUNCTION_DEF@0..56 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..6 - IDENT@3..6 "foo" - PARAM_LIST@6..8 - L_PAREN@6..7 "(" - R_PAREN@7..8 ")" - WHITESPACE@8..9 " " - BLOCK_EXPR@9..56 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - LET_STMT@15..21 - LET_KW@15..18 "let" - WHITESPACE@18..19 " " - BIND_PAT@19..20 - NAME@19..20 - IDENT@19..20 "a" - SEMI@20..21 ";" - WHITESPACE@21..26 "\n " - LET_STMT@26..36 - LET_KW@26..29 "let" - WHITESPACE@29..30 " " - BIND_PAT@30..31 - NAME@30..31 - IDENT@30..31 "b" - COLON@31..32 ":" - PATH_TYPE@32..35 - PATH@32..35 - PATH_SEGMENT@32..35 - NAME_REF@32..35 - IDENT@32..35 "i32" - SEMI@35..36 ";" - WHITESPACE@36..41 "\n " - LET_STMT@41..54 - LET_KW@41..44 "let" - WHITESPACE@44..45 " " - BIND_PAT@45..46 - NAME@45..46 - IDENT@45..46 "c" - COLON@46..47 ":" - PATH_TYPE@47..53 - PATH@47..53 - PATH_SEGMENT@47..53 - NAME_REF@47..53 - IDENT@47..53 "string" - SEMI@53..54 ";" - WHITESPACE@54..55 "\n" - R_CURLY@55..56 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__block_expr.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__block_expr.snap deleted file mode 100644 index 240824db9..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__block_expr.snap +++ /dev/null @@ -1,25 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn bar() {\n {3}\n}" ---- -SOURCE_FILE@0..20 - FUNCTION_DEF@0..20 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..6 - IDENT@3..6 "bar" - PARAM_LIST@6..8 - L_PAREN@6..7 "(" - R_PAREN@7..8 ")" - WHITESPACE@8..9 " " - BLOCK_EXPR@9..20 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - BLOCK_EXPR@15..18 - L_CURLY@15..16 "{" - LITERAL@16..17 - INT_NUMBER@16..17 "3" - R_CURLY@17..18 "}" - WHITESPACE@18..19 "\n" - R_CURLY@19..20 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__break_expr.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__break_expr.snap deleted file mode 100644 index 1bae325c4..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__break_expr.snap +++ /dev/null @@ -1,62 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn foo() {\n break;\n if break { 3; }\n if break 4 { 3; }\n}" ---- -SOURCE_FILE@0..65 - FUNCTION_DEF@0..65 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..6 - IDENT@3..6 "foo" - PARAM_LIST@6..8 - L_PAREN@6..7 "(" - R_PAREN@7..8 ")" - WHITESPACE@8..9 " " - BLOCK_EXPR@9..65 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - EXPR_STMT@15..21 - BREAK_EXPR@15..20 - BREAK_KW@15..20 "break" - SEMI@20..21 ";" - WHITESPACE@21..26 "\n " - EXPR_STMT@26..41 - IF_EXPR@26..41 - IF_KW@26..28 "if" - WHITESPACE@28..29 " " - CONDITION@29..34 - BREAK_EXPR@29..34 - BREAK_KW@29..34 "break" - WHITESPACE@34..35 " " - BLOCK_EXPR@35..41 - L_CURLY@35..36 "{" - WHITESPACE@36..37 " " - EXPR_STMT@37..39 - LITERAL@37..38 - INT_NUMBER@37..38 "3" - SEMI@38..39 ";" - WHITESPACE@39..40 " " - R_CURLY@40..41 "}" - WHITESPACE@41..46 "\n " - IF_EXPR@46..63 - IF_KW@46..48 "if" - WHITESPACE@48..49 " " - CONDITION@49..56 - BREAK_EXPR@49..56 - BREAK_KW@49..54 "break" - WHITESPACE@54..55 " " - LITERAL@55..56 - INT_NUMBER@55..56 "4" - WHITESPACE@56..57 " " - BLOCK_EXPR@57..63 - L_CURLY@57..58 "{" - WHITESPACE@58..59 " " - EXPR_STMT@59..61 - LITERAL@59..60 - INT_NUMBER@59..60 "3" - SEMI@60..61 ";" - WHITESPACE@61..62 " " - R_CURLY@62..63 "}" - WHITESPACE@63..64 "\n" - R_CURLY@64..65 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__compare_operands.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__compare_operands.snap deleted file mode 100644 index e196e1d0a..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__compare_operands.snap +++ /dev/null @@ -1,187 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn main() {\n let _ = a == b;\n let _ = a == b;\n let _ = a != b;\n let _ = a < b;\n let _ = a > b;\n let _ = a <= b;\n let _ = a >= b;\n}" ---- -SOURCE_FILE@0..151 - FUNCTION_DEF@0..151 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..7 - IDENT@3..7 "main" - PARAM_LIST@7..9 - L_PAREN@7..8 "(" - R_PAREN@8..9 ")" - WHITESPACE@9..10 " " - BLOCK_EXPR@10..151 - L_CURLY@10..11 "{" - WHITESPACE@11..16 "\n " - LET_STMT@16..31 - LET_KW@16..19 "let" - WHITESPACE@19..20 " " - PLACEHOLDER_PAT@20..21 - UNDERSCORE@20..21 "_" - WHITESPACE@21..22 " " - EQ@22..23 "=" - WHITESPACE@23..24 " " - BIN_EXPR@24..30 - PATH_EXPR@24..25 - PATH@24..25 - PATH_SEGMENT@24..25 - NAME_REF@24..25 - IDENT@24..25 "a" - WHITESPACE@25..26 " " - EQEQ@26..28 "==" - WHITESPACE@28..29 " " - PATH_EXPR@29..30 - PATH@29..30 - PATH_SEGMENT@29..30 - NAME_REF@29..30 - IDENT@29..30 "b" - SEMI@30..31 ";" - WHITESPACE@31..36 "\n " - LET_STMT@36..51 - LET_KW@36..39 "let" - WHITESPACE@39..40 " " - PLACEHOLDER_PAT@40..41 - UNDERSCORE@40..41 "_" - WHITESPACE@41..42 " " - EQ@42..43 "=" - WHITESPACE@43..44 " " - BIN_EXPR@44..50 - PATH_EXPR@44..45 - PATH@44..45 - PATH_SEGMENT@44..45 - NAME_REF@44..45 - IDENT@44..45 "a" - WHITESPACE@45..46 " " - EQEQ@46..48 "==" - WHITESPACE@48..49 " " - PATH_EXPR@49..50 - PATH@49..50 - PATH_SEGMENT@49..50 - NAME_REF@49..50 - IDENT@49..50 "b" - SEMI@50..51 ";" - WHITESPACE@51..56 "\n " - LET_STMT@56..71 - LET_KW@56..59 "let" - WHITESPACE@59..60 " " - PLACEHOLDER_PAT@60..61 - UNDERSCORE@60..61 "_" - WHITESPACE@61..62 " " - EQ@62..63 "=" - WHITESPACE@63..64 " " - BIN_EXPR@64..70 - PATH_EXPR@64..65 - PATH@64..65 - PATH_SEGMENT@64..65 - NAME_REF@64..65 - IDENT@64..65 "a" - WHITESPACE@65..66 " " - NEQ@66..68 "!=" - WHITESPACE@68..69 " " - PATH_EXPR@69..70 - PATH@69..70 - PATH_SEGMENT@69..70 - NAME_REF@69..70 - IDENT@69..70 "b" - SEMI@70..71 ";" - WHITESPACE@71..76 "\n " - LET_STMT@76..90 - LET_KW@76..79 "let" - WHITESPACE@79..80 " " - PLACEHOLDER_PAT@80..81 - UNDERSCORE@80..81 "_" - WHITESPACE@81..82 " " - EQ@82..83 "=" - WHITESPACE@83..84 " " - BIN_EXPR@84..89 - PATH_EXPR@84..85 - PATH@84..85 - PATH_SEGMENT@84..85 - NAME_REF@84..85 - IDENT@84..85 "a" - WHITESPACE@85..86 " " - LT@86..87 "<" - WHITESPACE@87..88 " " - PATH_EXPR@88..89 - PATH@88..89 - PATH_SEGMENT@88..89 - NAME_REF@88..89 - IDENT@88..89 "b" - SEMI@89..90 ";" - WHITESPACE@90..95 "\n " - LET_STMT@95..109 - LET_KW@95..98 "let" - WHITESPACE@98..99 " " - PLACEHOLDER_PAT@99..100 - UNDERSCORE@99..100 "_" - WHITESPACE@100..101 " " - EQ@101..102 "=" - WHITESPACE@102..103 " " - BIN_EXPR@103..108 - PATH_EXPR@103..104 - PATH@103..104 - PATH_SEGMENT@103..104 - NAME_REF@103..104 - IDENT@103..104 "a" - WHITESPACE@104..105 " " - GT@105..106 ">" - WHITESPACE@106..107 " " - PATH_EXPR@107..108 - PATH@107..108 - PATH_SEGMENT@107..108 - NAME_REF@107..108 - IDENT@107..108 "b" - SEMI@108..109 ";" - WHITESPACE@109..114 "\n " - LET_STMT@114..129 - LET_KW@114..117 "let" - WHITESPACE@117..118 " " - PLACEHOLDER_PAT@118..119 - UNDERSCORE@118..119 "_" - WHITESPACE@119..120 " " - EQ@120..121 "=" - WHITESPACE@121..122 " " - BIN_EXPR@122..128 - PATH_EXPR@122..123 - PATH@122..123 - PATH_SEGMENT@122..123 - NAME_REF@122..123 - IDENT@122..123 "a" - WHITESPACE@123..124 " " - LTEQ@124..126 "<=" - WHITESPACE@126..127 " " - PATH_EXPR@127..128 - PATH@127..128 - PATH_SEGMENT@127..128 - NAME_REF@127..128 - IDENT@127..128 "b" - SEMI@128..129 ";" - WHITESPACE@129..134 "\n " - LET_STMT@134..149 - LET_KW@134..137 "let" - WHITESPACE@137..138 " " - PLACEHOLDER_PAT@138..139 - UNDERSCORE@138..139 "_" - WHITESPACE@139..140 " " - EQ@140..141 "=" - WHITESPACE@141..142 " " - BIN_EXPR@142..148 - PATH_EXPR@142..143 - PATH@142..143 - PATH_SEGMENT@142..143 - NAME_REF@142..143 - IDENT@142..143 "a" - WHITESPACE@143..144 " " - GTEQ@144..146 ">=" - WHITESPACE@146..147 " " - PATH_EXPR@147..148 - PATH@147..148 - PATH_SEGMENT@147..148 - NAME_REF@147..148 - IDENT@147..148 "b" - SEMI@148..149 ";" - WHITESPACE@149..150 "\n" - R_CURLY@150..151 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__empty.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__empty.snap deleted file mode 100644 index bba39ffb2..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__empty.snap +++ /dev/null @@ -1,6 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "" ---- -SOURCE_FILE@0..0 - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__expression_statement.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__expression_statement.snap deleted file mode 100644 index 495274804..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__expression_statement.snap +++ /dev/null @@ -1,98 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn foo() {\n let a = \"hello\"\n let b = \"world\"\n let c\n b = \"Hello, world!\"\n !-5+2*(a+b);\n -3\n}" ---- -SOURCE_FILE@0..110 - FUNCTION_DEF@0..110 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..6 - IDENT@3..6 "foo" - PARAM_LIST@6..8 - L_PAREN@6..7 "(" - R_PAREN@7..8 ")" - WHITESPACE@8..9 " " - BLOCK_EXPR@9..110 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - LET_STMT@15..30 - LET_KW@15..18 "let" - WHITESPACE@18..19 " " - BIND_PAT@19..20 - NAME@19..20 - IDENT@19..20 "a" - WHITESPACE@20..21 " " - EQ@21..22 "=" - WHITESPACE@22..23 " " - LITERAL@23..30 - STRING@23..30 "\"hello\"" - WHITESPACE@30..35 "\n " - LET_STMT@35..50 - LET_KW@35..38 "let" - WHITESPACE@38..39 " " - BIND_PAT@39..40 - NAME@39..40 - IDENT@39..40 "b" - WHITESPACE@40..41 " " - EQ@41..42 "=" - WHITESPACE@42..43 " " - LITERAL@43..50 - STRING@43..50 "\"world\"" - WHITESPACE@50..55 "\n " - LET_STMT@55..60 - LET_KW@55..58 "let" - WHITESPACE@58..59 " " - BIND_PAT@59..60 - NAME@59..60 - IDENT@59..60 "c" - WHITESPACE@60..65 "\n " - EXPR_STMT@65..84 - BIN_EXPR@65..84 - PATH_EXPR@65..66 - PATH@65..66 - PATH_SEGMENT@65..66 - NAME_REF@65..66 - IDENT@65..66 "b" - WHITESPACE@66..67 " " - EQ@67..68 "=" - WHITESPACE@68..69 " " - LITERAL@69..84 - STRING@69..84 "\"Hello, world!\"" - WHITESPACE@84..89 "\n " - EXPR_STMT@89..101 - BIN_EXPR@89..100 - PREFIX_EXPR@89..92 - EXCLAMATION@89..90 "!" - PREFIX_EXPR@90..92 - MINUS@90..91 "-" - LITERAL@91..92 - INT_NUMBER@91..92 "5" - PLUS@92..93 "+" - BIN_EXPR@93..100 - LITERAL@93..94 - INT_NUMBER@93..94 "2" - STAR@94..95 "*" - PAREN_EXPR@95..100 - L_PAREN@95..96 "(" - BIN_EXPR@96..99 - PATH_EXPR@96..97 - PATH@96..97 - PATH_SEGMENT@96..97 - NAME_REF@96..97 - IDENT@96..97 "a" - PLUS@97..98 "+" - PATH_EXPR@98..99 - PATH@98..99 - PATH_SEGMENT@98..99 - NAME_REF@98..99 - IDENT@98..99 "b" - R_PAREN@99..100 ")" - SEMI@100..101 ";" - WHITESPACE@101..106 "\n " - PREFIX_EXPR@106..108 - MINUS@106..107 "-" - LITERAL@107..108 - INT_NUMBER@107..108 "3" - WHITESPACE@108..109 "\n" - R_CURLY@109..110 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__extern_fn.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__extern_fn.snap deleted file mode 100644 index b2627eb31..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__extern_fn.snap +++ /dev/null @@ -1,21 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: pub extern fn foo(); ---- -SOURCE_FILE@0..20 - FUNCTION_DEF@0..20 - VISIBILITY@0..3 - PUB_KW@0..3 "pub" - WHITESPACE@3..4 " " - EXTERN@4..10 - EXTERN_KW@4..10 "extern" - WHITESPACE@10..11 " " - FN_KW@11..13 "fn" - WHITESPACE@13..14 " " - NAME@14..17 - IDENT@14..17 "foo" - PARAM_LIST@17..19 - L_PAREN@17..18 "(" - R_PAREN@18..19 ")" - SEMI@19..20 ";" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__function.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__function.snap deleted file mode 100644 index 5baf2547d..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__function.snap +++ /dev/null @@ -1,111 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "// Source file comment\n\n// Comment that belongs to the function\nfn a() {}\nfn b(value:number) {}\npub fn d() {}\npub fn c()->never {}\nfn b(value:number)->number {}" ---- -SOURCE_FILE@0..160 - COMMENT@0..22 "// Source file comment" - WHITESPACE@22..24 "\n\n" - FUNCTION_DEF@24..73 - COMMENT@24..63 "// Comment that belon ..." - WHITESPACE@63..64 "\n" - FN_KW@64..66 "fn" - WHITESPACE@66..67 " " - NAME@67..68 - IDENT@67..68 "a" - PARAM_LIST@68..70 - L_PAREN@68..69 "(" - R_PAREN@69..70 ")" - WHITESPACE@70..71 " " - BLOCK_EXPR@71..73 - L_CURLY@71..72 "{" - R_CURLY@72..73 "}" - FUNCTION_DEF@73..95 - WHITESPACE@73..74 "\n" - FN_KW@74..76 "fn" - WHITESPACE@76..77 " " - NAME@77..78 - IDENT@77..78 "b" - PARAM_LIST@78..92 - L_PAREN@78..79 "(" - PARAM@79..91 - BIND_PAT@79..84 - NAME@79..84 - IDENT@79..84 "value" - COLON@84..85 ":" - PATH_TYPE@85..91 - PATH@85..91 - PATH_SEGMENT@85..91 - NAME_REF@85..91 - IDENT@85..91 "number" - R_PAREN@91..92 ")" - WHITESPACE@92..93 " " - BLOCK_EXPR@93..95 - L_CURLY@93..94 "{" - R_CURLY@94..95 "}" - FUNCTION_DEF@95..109 - WHITESPACE@95..96 "\n" - VISIBILITY@96..99 - PUB_KW@96..99 "pub" - WHITESPACE@99..100 " " - FN_KW@100..102 "fn" - WHITESPACE@102..103 " " - NAME@103..104 - IDENT@103..104 "d" - PARAM_LIST@104..106 - L_PAREN@104..105 "(" - R_PAREN@105..106 ")" - WHITESPACE@106..107 " " - BLOCK_EXPR@107..109 - L_CURLY@107..108 "{" - R_CURLY@108..109 "}" - FUNCTION_DEF@109..130 - WHITESPACE@109..110 "\n" - VISIBILITY@110..113 - PUB_KW@110..113 "pub" - WHITESPACE@113..114 " " - FN_KW@114..116 "fn" - WHITESPACE@116..117 " " - NAME@117..118 - IDENT@117..118 "c" - PARAM_LIST@118..120 - L_PAREN@118..119 "(" - R_PAREN@119..120 ")" - RET_TYPE@120..127 - THIN_ARROW@120..122 "->" - NEVER_TYPE@122..127 - NEVER_KW@122..127 "never" - WHITESPACE@127..128 " " - BLOCK_EXPR@128..130 - L_CURLY@128..129 "{" - R_CURLY@129..130 "}" - FUNCTION_DEF@130..160 - WHITESPACE@130..131 "\n" - FN_KW@131..133 "fn" - WHITESPACE@133..134 " " - NAME@134..135 - IDENT@134..135 "b" - PARAM_LIST@135..149 - L_PAREN@135..136 "(" - PARAM@136..148 - BIND_PAT@136..141 - NAME@136..141 - IDENT@136..141 "value" - COLON@141..142 ":" - PATH_TYPE@142..148 - PATH@142..148 - PATH_SEGMENT@142..148 - NAME_REF@142..148 - IDENT@142..148 "number" - R_PAREN@148..149 ")" - RET_TYPE@149..157 - THIN_ARROW@149..151 "->" - PATH_TYPE@151..157 - PATH@151..157 - PATH_SEGMENT@151..157 - NAME_REF@151..157 - IDENT@151..157 "number" - WHITESPACE@157..158 " " - BLOCK_EXPR@158..160 - L_CURLY@158..159 "{" - R_CURLY@159..160 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__function_calls.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__function_calls.snap deleted file mode 100644 index 412745ff8..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__function_calls.snap +++ /dev/null @@ -1,72 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn bar(i:number) { }\nfn foo(i:number) {\n bar(i+1)\n}" ---- -SOURCE_FILE@0..52 - FUNCTION_DEF@0..20 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..6 - IDENT@3..6 "bar" - PARAM_LIST@6..16 - L_PAREN@6..7 "(" - PARAM@7..15 - BIND_PAT@7..8 - NAME@7..8 - IDENT@7..8 "i" - COLON@8..9 ":" - PATH_TYPE@9..15 - PATH@9..15 - PATH_SEGMENT@9..15 - NAME_REF@9..15 - IDENT@9..15 "number" - R_PAREN@15..16 ")" - WHITESPACE@16..17 " " - BLOCK_EXPR@17..20 - L_CURLY@17..18 "{" - WHITESPACE@18..19 " " - R_CURLY@19..20 "}" - FUNCTION_DEF@20..52 - WHITESPACE@20..21 "\n" - FN_KW@21..23 "fn" - WHITESPACE@23..24 " " - NAME@24..27 - IDENT@24..27 "foo" - PARAM_LIST@27..37 - L_PAREN@27..28 "(" - PARAM@28..36 - BIND_PAT@28..29 - NAME@28..29 - IDENT@28..29 "i" - COLON@29..30 ":" - PATH_TYPE@30..36 - PATH@30..36 - PATH_SEGMENT@30..36 - NAME_REF@30..36 - IDENT@30..36 "number" - R_PAREN@36..37 ")" - WHITESPACE@37..38 " " - BLOCK_EXPR@38..52 - L_CURLY@38..39 "{" - WHITESPACE@39..42 "\n " - CALL_EXPR@42..50 - PATH_EXPR@42..45 - PATH@42..45 - PATH_SEGMENT@42..45 - NAME_REF@42..45 - IDENT@42..45 "bar" - ARG_LIST@45..50 - L_PAREN@45..46 "(" - BIN_EXPR@46..49 - PATH_EXPR@46..47 - PATH@46..47 - PATH_SEGMENT@46..47 - NAME_REF@46..47 - IDENT@46..47 "i" - PLUS@47..48 "+" - LITERAL@48..49 - INT_NUMBER@48..49 "1" - R_PAREN@49..50 ")" - WHITESPACE@50..51 "\n" - R_CURLY@51..52 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__function_return_path.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__function_return_path.snap deleted file mode 100644 index ae229a0b0..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__function_return_path.snap +++ /dev/null @@ -1,114 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn main() -> self::Foo {}\n fn main1() -> super::Foo {}\n fn main2() -> package::Foo {}\n fn main3() -> package::foo::Foo {}" ---- -SOURCE_FILE@0..130 - FUNCTION_DEF@0..25 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..7 - IDENT@3..7 "main" - PARAM_LIST@7..9 - L_PAREN@7..8 "(" - R_PAREN@8..9 ")" - WHITESPACE@9..10 " " - RET_TYPE@10..22 - THIN_ARROW@10..12 "->" - WHITESPACE@12..13 " " - PATH_TYPE@13..22 - PATH@13..22 - PATH@13..17 - PATH_SEGMENT@13..17 - SELF_KW@13..17 "self" - COLONCOLON@17..19 "::" - PATH_SEGMENT@19..22 - NAME_REF@19..22 - IDENT@19..22 "Foo" - WHITESPACE@22..23 " " - BLOCK_EXPR@23..25 - L_CURLY@23..24 "{" - R_CURLY@24..25 "}" - FUNCTION_DEF@25..57 - WHITESPACE@25..30 "\n " - FN_KW@30..32 "fn" - WHITESPACE@32..33 " " - NAME@33..38 - IDENT@33..38 "main1" - PARAM_LIST@38..40 - L_PAREN@38..39 "(" - R_PAREN@39..40 ")" - WHITESPACE@40..41 " " - RET_TYPE@41..54 - THIN_ARROW@41..43 "->" - WHITESPACE@43..44 " " - PATH_TYPE@44..54 - PATH@44..54 - PATH@44..49 - PATH_SEGMENT@44..49 - SUPER_KW@44..49 "super" - COLONCOLON@49..51 "::" - PATH_SEGMENT@51..54 - NAME_REF@51..54 - IDENT@51..54 "Foo" - WHITESPACE@54..55 " " - BLOCK_EXPR@55..57 - L_CURLY@55..56 "{" - R_CURLY@56..57 "}" - FUNCTION_DEF@57..91 - WHITESPACE@57..62 "\n " - FN_KW@62..64 "fn" - WHITESPACE@64..65 " " - NAME@65..70 - IDENT@65..70 "main2" - PARAM_LIST@70..72 - L_PAREN@70..71 "(" - R_PAREN@71..72 ")" - WHITESPACE@72..73 " " - RET_TYPE@73..88 - THIN_ARROW@73..75 "->" - WHITESPACE@75..76 " " - PATH_TYPE@76..88 - PATH@76..88 - PATH@76..83 - PATH_SEGMENT@76..83 - PACKAGE_KW@76..83 "package" - COLONCOLON@83..85 "::" - PATH_SEGMENT@85..88 - NAME_REF@85..88 - IDENT@85..88 "Foo" - WHITESPACE@88..89 " " - BLOCK_EXPR@89..91 - L_CURLY@89..90 "{" - R_CURLY@90..91 "}" - FUNCTION_DEF@91..130 - WHITESPACE@91..96 "\n " - FN_KW@96..98 "fn" - WHITESPACE@98..99 " " - NAME@99..104 - IDENT@99..104 "main3" - PARAM_LIST@104..106 - L_PAREN@104..105 "(" - R_PAREN@105..106 ")" - WHITESPACE@106..107 " " - RET_TYPE@107..127 - THIN_ARROW@107..109 "->" - WHITESPACE@109..110 " " - PATH_TYPE@110..127 - PATH@110..127 - PATH@110..122 - PATH@110..117 - PATH_SEGMENT@110..117 - PACKAGE_KW@110..117 "package" - COLONCOLON@117..119 "::" - PATH_SEGMENT@119..122 - NAME_REF@119..122 - IDENT@119..122 "foo" - COLONCOLON@122..124 "::" - PATH_SEGMENT@124..127 - NAME_REF@124..127 - IDENT@124..127 "Foo" - WHITESPACE@127..128 " " - BLOCK_EXPR@128..130 - L_CURLY@128..129 "{" - R_CURLY@129..130 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__if_expr.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__if_expr.snap deleted file mode 100644 index dd3d6d71d..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__if_expr.snap +++ /dev/null @@ -1,103 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn bar() {\n if true {};\n if true {} else {};\n if true {} else if false {} else {};\n if {true} {} else {}\n}" ---- -SOURCE_FILE@0..118 - FUNCTION_DEF@0..118 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..6 - IDENT@3..6 "bar" - PARAM_LIST@6..8 - L_PAREN@6..7 "(" - R_PAREN@7..8 ")" - WHITESPACE@8..9 " " - BLOCK_EXPR@9..118 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - EXPR_STMT@15..26 - IF_EXPR@15..25 - IF_KW@15..17 "if" - WHITESPACE@17..18 " " - CONDITION@18..22 - LITERAL@18..22 - TRUE_KW@18..22 "true" - WHITESPACE@22..23 " " - BLOCK_EXPR@23..25 - L_CURLY@23..24 "{" - R_CURLY@24..25 "}" - SEMI@25..26 ";" - WHITESPACE@26..31 "\n " - EXPR_STMT@31..50 - IF_EXPR@31..49 - IF_KW@31..33 "if" - WHITESPACE@33..34 " " - CONDITION@34..38 - LITERAL@34..38 - TRUE_KW@34..38 "true" - WHITESPACE@38..39 " " - BLOCK_EXPR@39..41 - L_CURLY@39..40 "{" - R_CURLY@40..41 "}" - WHITESPACE@41..42 " " - ELSE_KW@42..46 "else" - WHITESPACE@46..47 " " - BLOCK_EXPR@47..49 - L_CURLY@47..48 "{" - R_CURLY@48..49 "}" - SEMI@49..50 ";" - WHITESPACE@50..55 "\n " - EXPR_STMT@55..91 - IF_EXPR@55..90 - IF_KW@55..57 "if" - WHITESPACE@57..58 " " - CONDITION@58..62 - LITERAL@58..62 - TRUE_KW@58..62 "true" - WHITESPACE@62..63 " " - BLOCK_EXPR@63..65 - L_CURLY@63..64 "{" - R_CURLY@64..65 "}" - WHITESPACE@65..66 " " - ELSE_KW@66..70 "else" - WHITESPACE@70..71 " " - IF_EXPR@71..90 - IF_KW@71..73 "if" - WHITESPACE@73..74 " " - CONDITION@74..79 - LITERAL@74..79 - FALSE_KW@74..79 "false" - WHITESPACE@79..80 " " - BLOCK_EXPR@80..82 - L_CURLY@80..81 "{" - R_CURLY@81..82 "}" - WHITESPACE@82..83 " " - ELSE_KW@83..87 "else" - WHITESPACE@87..88 " " - BLOCK_EXPR@88..90 - L_CURLY@88..89 "{" - R_CURLY@89..90 "}" - SEMI@90..91 ";" - WHITESPACE@91..96 "\n " - IF_EXPR@96..116 - IF_KW@96..98 "if" - WHITESPACE@98..99 " " - CONDITION@99..105 - BLOCK_EXPR@99..105 - L_CURLY@99..100 "{" - LITERAL@100..104 - TRUE_KW@100..104 "true" - R_CURLY@104..105 "}" - WHITESPACE@105..106 " " - BLOCK_EXPR@106..108 - L_CURLY@106..107 "{" - R_CURLY@107..108 "}" - WHITESPACE@108..109 " " - ELSE_KW@109..113 "else" - WHITESPACE@113..114 " " - BLOCK_EXPR@114..116 - L_CURLY@114..115 "{" - R_CURLY@115..116 "}" - WHITESPACE@116..117 "\n" - R_CURLY@117..118 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__literals.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__literals.snap deleted file mode 100644 index 586af60e5..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__literals.snap +++ /dev/null @@ -1,83 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn foo() {\n let a = true;\n let b = false;\n let c = 1;\n let d = 1.12;\n let e = \"Hello, world!\"\n}" ---- -SOURCE_FILE@0..110 - FUNCTION_DEF@0..110 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..6 - IDENT@3..6 "foo" - PARAM_LIST@6..8 - L_PAREN@6..7 "(" - R_PAREN@7..8 ")" - WHITESPACE@8..9 " " - BLOCK_EXPR@9..110 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - LET_STMT@15..28 - LET_KW@15..18 "let" - WHITESPACE@18..19 " " - BIND_PAT@19..20 - NAME@19..20 - IDENT@19..20 "a" - WHITESPACE@20..21 " " - EQ@21..22 "=" - WHITESPACE@22..23 " " - LITERAL@23..27 - TRUE_KW@23..27 "true" - SEMI@27..28 ";" - WHITESPACE@28..33 "\n " - LET_STMT@33..47 - LET_KW@33..36 "let" - WHITESPACE@36..37 " " - BIND_PAT@37..38 - NAME@37..38 - IDENT@37..38 "b" - WHITESPACE@38..39 " " - EQ@39..40 "=" - WHITESPACE@40..41 " " - LITERAL@41..46 - FALSE_KW@41..46 "false" - SEMI@46..47 ";" - WHITESPACE@47..52 "\n " - LET_STMT@52..62 - LET_KW@52..55 "let" - WHITESPACE@55..56 " " - BIND_PAT@56..57 - NAME@56..57 - IDENT@56..57 "c" - WHITESPACE@57..58 " " - EQ@58..59 "=" - WHITESPACE@59..60 " " - LITERAL@60..61 - INT_NUMBER@60..61 "1" - SEMI@61..62 ";" - WHITESPACE@62..67 "\n " - LET_STMT@67..80 - LET_KW@67..70 "let" - WHITESPACE@70..71 " " - BIND_PAT@71..72 - NAME@71..72 - IDENT@71..72 "d" - WHITESPACE@72..73 " " - EQ@73..74 "=" - WHITESPACE@74..75 " " - LITERAL@75..79 - FLOAT_NUMBER@75..79 "1.12" - SEMI@79..80 ";" - WHITESPACE@80..85 "\n " - LET_STMT@85..108 - LET_KW@85..88 "let" - WHITESPACE@88..89 " " - BIND_PAT@89..90 - NAME@89..90 - IDENT@89..90 "e" - WHITESPACE@90..91 " " - EQ@91..92 "=" - WHITESPACE@92..93 " " - LITERAL@93..108 - STRING@93..108 "\"Hello, world!\"" - WHITESPACE@108..109 "\n" - R_CURLY@109..110 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__logic_operands.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__logic_operands.snap deleted file mode 100644 index 905e79c8c..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__logic_operands.snap +++ /dev/null @@ -1,67 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn main() {\n let _ = a || b;\n let _ = a && b;\n}" ---- -SOURCE_FILE@0..53 - FUNCTION_DEF@0..53 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..7 - IDENT@3..7 "main" - PARAM_LIST@7..9 - L_PAREN@7..8 "(" - R_PAREN@8..9 ")" - WHITESPACE@9..10 " " - BLOCK_EXPR@10..53 - L_CURLY@10..11 "{" - WHITESPACE@11..16 "\n " - LET_STMT@16..31 - LET_KW@16..19 "let" - WHITESPACE@19..20 " " - PLACEHOLDER_PAT@20..21 - UNDERSCORE@20..21 "_" - WHITESPACE@21..22 " " - EQ@22..23 "=" - WHITESPACE@23..24 " " - BIN_EXPR@24..30 - PATH_EXPR@24..25 - PATH@24..25 - PATH_SEGMENT@24..25 - NAME_REF@24..25 - IDENT@24..25 "a" - WHITESPACE@25..26 " " - PIPEPIPE@26..28 "||" - WHITESPACE@28..29 " " - PATH_EXPR@29..30 - PATH@29..30 - PATH_SEGMENT@29..30 - NAME_REF@29..30 - IDENT@29..30 "b" - SEMI@30..31 ";" - WHITESPACE@31..36 "\n " - LET_STMT@36..51 - LET_KW@36..39 "let" - WHITESPACE@39..40 " " - PLACEHOLDER_PAT@40..41 - UNDERSCORE@40..41 "_" - WHITESPACE@41..42 " " - EQ@42..43 "=" - WHITESPACE@43..44 " " - BIN_EXPR@44..50 - PATH_EXPR@44..45 - PATH@44..45 - PATH_SEGMENT@44..45 - NAME_REF@44..45 - IDENT@44..45 "a" - WHITESPACE@45..46 " " - AMPAMP@46..48 "&&" - WHITESPACE@48..49 " " - PATH_EXPR@49..50 - PATH@49..50 - PATH_SEGMENT@49..50 - NAME_REF@49..50 - IDENT@49..50 "b" - SEMI@50..51 ";" - WHITESPACE@51..52 "\n" - R_CURLY@52..53 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__loop_expr.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__loop_expr.snap deleted file mode 100644 index 227f81e7f..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__loop_expr.snap +++ /dev/null @@ -1,26 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn foo() {\n loop {}\n}" ---- -SOURCE_FILE@0..24 - FUNCTION_DEF@0..24 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..6 - IDENT@3..6 "foo" - PARAM_LIST@6..8 - L_PAREN@6..7 "(" - R_PAREN@7..8 ")" - WHITESPACE@8..9 " " - BLOCK_EXPR@9..24 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - LOOP_EXPR@15..22 - LOOP_KW@15..19 "loop" - WHITESPACE@19..20 " " - BLOCK_EXPR@20..22 - L_CURLY@20..21 "{" - R_CURLY@21..22 "}" - WHITESPACE@22..23 "\n" - R_CURLY@23..24 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__memory_type_specifier.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__memory_type_specifier.snap deleted file mode 100644 index b751bdaa0..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__memory_type_specifier.snap +++ /dev/null @@ -1,82 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "struct Foo {};\nstruct(gc) Baz {};\nstruct(value) Baz {};\nstruct() Err1 {}; // error: expected memory type specifier\nstruct(foo) Err2 {}; // error: expected memory type specifier" ---- -SOURCE_FILE@0..179 - STRUCT_DEF@0..14 - STRUCT_KW@0..6 "struct" - WHITESPACE@6..7 " " - NAME@7..10 - IDENT@7..10 "Foo" - WHITESPACE@10..11 " " - RECORD_FIELD_DEF_LIST@11..14 - L_CURLY@11..12 "{" - R_CURLY@12..13 "}" - SEMI@13..14 ";" - WHITESPACE@14..15 "\n" - STRUCT_DEF@15..33 - STRUCT_KW@15..21 "struct" - MEMORY_TYPE_SPECIFIER@21..25 - L_PAREN@21..22 "(" - GC_KW@22..24 "gc" - R_PAREN@24..25 ")" - WHITESPACE@25..26 " " - NAME@26..29 - IDENT@26..29 "Baz" - WHITESPACE@29..30 " " - RECORD_FIELD_DEF_LIST@30..33 - L_CURLY@30..31 "{" - R_CURLY@31..32 "}" - SEMI@32..33 ";" - WHITESPACE@33..34 "\n" - STRUCT_DEF@34..55 - STRUCT_KW@34..40 "struct" - MEMORY_TYPE_SPECIFIER@40..47 - L_PAREN@40..41 "(" - VALUE_KW@41..46 "value" - R_PAREN@46..47 ")" - WHITESPACE@47..48 " " - NAME@48..51 - IDENT@48..51 "Baz" - WHITESPACE@51..52 " " - RECORD_FIELD_DEF_LIST@52..55 - L_CURLY@52..53 "{" - R_CURLY@53..54 "}" - SEMI@54..55 ";" - WHITESPACE@55..56 "\n" - STRUCT_DEF@56..73 - STRUCT_KW@56..62 "struct" - MEMORY_TYPE_SPECIFIER@62..64 - L_PAREN@62..63 "(" - R_PAREN@63..64 ")" - WHITESPACE@64..65 " " - NAME@65..69 - IDENT@65..69 "Err1" - WHITESPACE@69..70 " " - RECORD_FIELD_DEF_LIST@70..73 - L_CURLY@70..71 "{" - R_CURLY@71..72 "}" - SEMI@72..73 ";" - WHITESPACE@73..77 " " - COMMENT@77..117 "// error: expected me ..." - WHITESPACE@117..118 "\n" - STRUCT_DEF@118..138 - STRUCT_KW@118..124 "struct" - MEMORY_TYPE_SPECIFIER@124..129 - L_PAREN@124..125 "(" - ERROR@125..128 - IDENT@125..128 "foo" - R_PAREN@128..129 ")" - WHITESPACE@129..130 " " - NAME@130..134 - IDENT@130..134 "Err2" - WHITESPACE@134..135 " " - RECORD_FIELD_DEF_LIST@135..138 - L_CURLY@135..136 "{" - R_CURLY@136..137 "}" - SEMI@137..138 ";" - WHITESPACE@138..139 " " - COMMENT@139..179 "// error: expected me ..." -error Offset(63): expected memory type specifier -error Offset(125): expected memory type specifier - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__missing_field_expr.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__missing_field_expr.snap deleted file mode 100644 index 15e860b78..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__missing_field_expr.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn foo() {\n var.\n}" ---- -SOURCE_FILE@0..21 - FUNCTION_DEF@0..21 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..6 - IDENT@3..6 "foo" - PARAM_LIST@6..8 - L_PAREN@6..7 "(" - R_PAREN@7..8 ")" - WHITESPACE@8..9 " " - BLOCK_EXPR@9..21 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - FIELD_EXPR@15..19 - PATH_EXPR@15..18 - PATH@15..18 - PATH_SEGMENT@15..18 - NAME_REF@15..18 - IDENT@15..18 "var" - DOT@18..19 "." - WHITESPACE@19..20 "\n" - R_CURLY@20..21 "}" -error Offset(19): expected field name or number - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__patterns.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__patterns.snap deleted file mode 100644 index 379405b4a..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__patterns.snap +++ /dev/null @@ -1,56 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn main(_:number) {\n let a = 0;\n let _ = a;\n}" ---- -SOURCE_FILE@0..49 - FUNCTION_DEF@0..49 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..7 - IDENT@3..7 "main" - PARAM_LIST@7..17 - L_PAREN@7..8 "(" - PARAM@8..16 - PLACEHOLDER_PAT@8..9 - UNDERSCORE@8..9 "_" - COLON@9..10 ":" - PATH_TYPE@10..16 - PATH@10..16 - PATH_SEGMENT@10..16 - NAME_REF@10..16 - IDENT@10..16 "number" - R_PAREN@16..17 ")" - WHITESPACE@17..18 " " - BLOCK_EXPR@18..49 - L_CURLY@18..19 "{" - WHITESPACE@19..23 "\n " - LET_STMT@23..33 - LET_KW@23..26 "let" - WHITESPACE@26..27 " " - BIND_PAT@27..28 - NAME@27..28 - IDENT@27..28 "a" - WHITESPACE@28..29 " " - EQ@29..30 "=" - WHITESPACE@30..31 " " - LITERAL@31..32 - INT_NUMBER@31..32 "0" - SEMI@32..33 ";" - WHITESPACE@33..37 "\n " - LET_STMT@37..47 - LET_KW@37..40 "let" - WHITESPACE@40..41 " " - PLACEHOLDER_PAT@41..42 - UNDERSCORE@41..42 "_" - WHITESPACE@42..43 " " - EQ@43..44 "=" - WHITESPACE@44..45 " " - PATH_EXPR@45..46 - PATH@45..46 - PATH_SEGMENT@45..46 - NAME_REF@45..46 - IDENT@45..46 "a" - SEMI@46..47 ";" - WHITESPACE@47..48 "\n" - R_CURLY@48..49 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__return_expr.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__return_expr.snap deleted file mode 100644 index 76d5c9722..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__return_expr.snap +++ /dev/null @@ -1,32 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn foo() {\n return;\n return 50;\n}" ---- -SOURCE_FILE@0..39 - FUNCTION_DEF@0..39 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..6 - IDENT@3..6 "foo" - PARAM_LIST@6..8 - L_PAREN@6..7 "(" - R_PAREN@7..8 ")" - WHITESPACE@8..9 " " - BLOCK_EXPR@9..39 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - EXPR_STMT@15..22 - RETURN_EXPR@15..21 - RETURN_KW@15..21 "return" - SEMI@21..22 ";" - WHITESPACE@22..27 "\n " - EXPR_STMT@27..37 - RETURN_EXPR@27..36 - RETURN_KW@27..33 "return" - WHITESPACE@33..34 " " - LITERAL@34..36 - INT_NUMBER@34..36 "50" - SEMI@36..37 ";" - WHITESPACE@37..38 "\n" - R_CURLY@38..39 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__struct_def.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__struct_def.snap deleted file mode 100644 index fbcb79975..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__struct_def.snap +++ /dev/null @@ -1,218 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "struct Foo // error: expected a ';', or a '{'\nstruct Foo;\nstruct Foo;; // error: expected a declaration\nstruct Foo {}\nstruct Foo {};\nstruct Foo {,}; // error: expected a field declaration\nstruct Foo {\n a: f64,\n}\nstruct Foo {\n a: f64,\n b: i32,\n};\nstruct Foo()\nstruct Foo();\nstruct Foo(,); // error: expected a type\nstruct Foo(f64)\nstruct Foo(f64,);\nstruct Foo(f64, i32)" ---- -SOURCE_FILE@0..386 - STRUCT_DEF@0..10 - STRUCT_KW@0..6 "struct" - WHITESPACE@6..7 " " - NAME@7..10 - IDENT@7..10 "Foo" - WHITESPACE@10..16 " " - COMMENT@16..50 "// error: expected a ..." - WHITESPACE@50..51 "\n" - STRUCT_DEF@51..62 - STRUCT_KW@51..57 "struct" - WHITESPACE@57..58 " " - NAME@58..61 - IDENT@58..61 "Foo" - SEMI@61..62 ";" - WHITESPACE@62..63 "\n" - STRUCT_DEF@63..74 - STRUCT_KW@63..69 "struct" - WHITESPACE@69..70 " " - NAME@70..73 - IDENT@70..73 "Foo" - SEMI@73..74 ";" - ERROR@74..75 - SEMI@74..75 ";" - WHITESPACE@75..79 " " - COMMENT@79..111 "// error: expected a ..." - WHITESPACE@111..112 "\n" - STRUCT_DEF@112..125 - STRUCT_KW@112..118 "struct" - WHITESPACE@118..119 " " - NAME@119..122 - IDENT@119..122 "Foo" - WHITESPACE@122..123 " " - RECORD_FIELD_DEF_LIST@123..125 - L_CURLY@123..124 "{" - R_CURLY@124..125 "}" - WHITESPACE@125..126 "\n" - STRUCT_DEF@126..140 - STRUCT_KW@126..132 "struct" - WHITESPACE@132..133 " " - NAME@133..136 - IDENT@133..136 "Foo" - WHITESPACE@136..137 " " - RECORD_FIELD_DEF_LIST@137..140 - L_CURLY@137..138 "{" - R_CURLY@138..139 "}" - SEMI@139..140 ";" - WHITESPACE@140..141 "\n" - STRUCT_DEF@141..156 - STRUCT_KW@141..147 "struct" - WHITESPACE@147..148 " " - NAME@148..151 - IDENT@148..151 "Foo" - WHITESPACE@151..152 " " - RECORD_FIELD_DEF_LIST@152..156 - L_CURLY@152..153 "{" - ERROR@153..154 - COMMA@153..154 "," - R_CURLY@154..155 "}" - SEMI@155..156 ";" - WHITESPACE@156..157 " " - COMMENT@157..195 "// error: expected a ..." - WHITESPACE@195..196 "\n" - STRUCT_DEF@196..222 - STRUCT_KW@196..202 "struct" - WHITESPACE@202..203 " " - NAME@203..206 - IDENT@203..206 "Foo" - WHITESPACE@206..207 " " - RECORD_FIELD_DEF_LIST@207..222 - L_CURLY@207..208 "{" - WHITESPACE@208..213 "\n " - RECORD_FIELD_DEF@213..219 - NAME@213..214 - IDENT@213..214 "a" - COLON@214..215 ":" - WHITESPACE@215..216 " " - PATH_TYPE@216..219 - PATH@216..219 - PATH_SEGMENT@216..219 - NAME_REF@216..219 - IDENT@216..219 "f64" - COMMA@219..220 "," - WHITESPACE@220..221 "\n" - R_CURLY@221..222 "}" - WHITESPACE@222..223 "\n" - STRUCT_DEF@223..262 - STRUCT_KW@223..229 "struct" - WHITESPACE@229..230 " " - NAME@230..233 - IDENT@230..233 "Foo" - WHITESPACE@233..234 " " - RECORD_FIELD_DEF_LIST@234..262 - L_CURLY@234..235 "{" - WHITESPACE@235..240 "\n " - RECORD_FIELD_DEF@240..246 - NAME@240..241 - IDENT@240..241 "a" - COLON@241..242 ":" - WHITESPACE@242..243 " " - PATH_TYPE@243..246 - PATH@243..246 - PATH_SEGMENT@243..246 - NAME_REF@243..246 - IDENT@243..246 "f64" - COMMA@246..247 "," - WHITESPACE@247..252 "\n " - RECORD_FIELD_DEF@252..258 - NAME@252..253 - IDENT@252..253 "b" - COLON@253..254 ":" - WHITESPACE@254..255 " " - PATH_TYPE@255..258 - PATH@255..258 - PATH_SEGMENT@255..258 - NAME_REF@255..258 - IDENT@255..258 "i32" - COMMA@258..259 "," - WHITESPACE@259..260 "\n" - R_CURLY@260..261 "}" - SEMI@261..262 ";" - WHITESPACE@262..263 "\n" - STRUCT_DEF@263..275 - STRUCT_KW@263..269 "struct" - WHITESPACE@269..270 " " - NAME@270..273 - IDENT@270..273 "Foo" - TUPLE_FIELD_DEF_LIST@273..275 - L_PAREN@273..274 "(" - R_PAREN@274..275 ")" - WHITESPACE@275..276 "\n" - STRUCT_DEF@276..289 - STRUCT_KW@276..282 "struct" - WHITESPACE@282..283 " " - NAME@283..286 - IDENT@283..286 "Foo" - TUPLE_FIELD_DEF_LIST@286..289 - L_PAREN@286..287 "(" - R_PAREN@287..288 ")" - SEMI@288..289 ";" - WHITESPACE@289..290 "\n" - STRUCT_DEF@290..304 - STRUCT_KW@290..296 "struct" - WHITESPACE@296..297 " " - NAME@297..300 - IDENT@297..300 "Foo" - TUPLE_FIELD_DEF_LIST@300..304 - L_PAREN@300..301 "(" - ERROR@301..302 - COMMA@301..302 "," - R_PAREN@302..303 ")" - SEMI@303..304 ";" - WHITESPACE@304..306 " " - COMMENT@306..331 "// error: expected a ..." - WHITESPACE@331..332 "\n" - STRUCT_DEF@332..347 - STRUCT_KW@332..338 "struct" - WHITESPACE@338..339 " " - NAME@339..342 - IDENT@339..342 "Foo" - TUPLE_FIELD_DEF_LIST@342..347 - L_PAREN@342..343 "(" - TUPLE_FIELD_DEF@343..346 - PATH_TYPE@343..346 - PATH@343..346 - PATH_SEGMENT@343..346 - NAME_REF@343..346 - IDENT@343..346 "f64" - R_PAREN@346..347 ")" - WHITESPACE@347..348 "\n" - STRUCT_DEF@348..365 - STRUCT_KW@348..354 "struct" - WHITESPACE@354..355 " " - NAME@355..358 - IDENT@355..358 "Foo" - TUPLE_FIELD_DEF_LIST@358..365 - L_PAREN@358..359 "(" - TUPLE_FIELD_DEF@359..362 - PATH_TYPE@359..362 - PATH@359..362 - PATH_SEGMENT@359..362 - NAME_REF@359..362 - IDENT@359..362 "f64" - COMMA@362..363 "," - R_PAREN@363..364 ")" - SEMI@364..365 ";" - WHITESPACE@365..366 "\n" - STRUCT_DEF@366..386 - STRUCT_KW@366..372 "struct" - WHITESPACE@372..373 " " - NAME@373..376 - IDENT@373..376 "Foo" - TUPLE_FIELD_DEF_LIST@376..386 - L_PAREN@376..377 "(" - TUPLE_FIELD_DEF@377..380 - PATH_TYPE@377..380 - PATH@377..380 - PATH_SEGMENT@377..380 - NAME_REF@377..380 - IDENT@377..380 "f64" - COMMA@380..381 "," - WHITESPACE@381..382 " " - TUPLE_FIELD_DEF@382..385 - PATH_TYPE@382..385 - PATH@382..385 - PATH_SEGMENT@382..385 - NAME_REF@382..385 - IDENT@382..385 "i32" - R_PAREN@385..386 ")" -error Offset(10): expected a ';', '{', or '(' -error Offset(74): expected a declaration -error Offset(153): expected a field declaration -error Offset(301): expected a type - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__struct_field_index.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__struct_field_index.snap deleted file mode 100644 index 0e2bc762d..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__struct_field_index.snap +++ /dev/null @@ -1,115 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn main() {\n foo.a\n foo.a.b\n foo.0\n foo.0.1\n foo.10\n foo.01 // index: .0\n foo.0 1 // index: .0 \n foo.a.0\n}" ---- -SOURCE_FILE@0..131 - FUNCTION_DEF@0..131 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..7 - IDENT@3..7 "main" - PARAM_LIST@7..9 - L_PAREN@7..8 "(" - R_PAREN@8..9 ")" - WHITESPACE@9..10 " " - BLOCK_EXPR@10..131 - L_CURLY@10..11 "{" - WHITESPACE@11..16 "\n " - EXPR_STMT@16..21 - FIELD_EXPR@16..21 - PATH_EXPR@16..19 - PATH@16..19 - PATH_SEGMENT@16..19 - NAME_REF@16..19 - IDENT@16..19 "foo" - DOT@19..20 "." - NAME_REF@20..21 - IDENT@20..21 "a" - WHITESPACE@21..26 "\n " - EXPR_STMT@26..33 - FIELD_EXPR@26..33 - FIELD_EXPR@26..31 - PATH_EXPR@26..29 - PATH@26..29 - PATH_SEGMENT@26..29 - NAME_REF@26..29 - IDENT@26..29 "foo" - DOT@29..30 "." - NAME_REF@30..31 - IDENT@30..31 "a" - DOT@31..32 "." - NAME_REF@32..33 - IDENT@32..33 "b" - WHITESPACE@33..38 "\n " - EXPR_STMT@38..43 - FIELD_EXPR@38..43 - PATH_EXPR@38..41 - PATH@38..41 - PATH_SEGMENT@38..41 - NAME_REF@38..41 - IDENT@38..41 "foo" - INDEX@41..43 ".0" - WHITESPACE@43..48 "\n " - EXPR_STMT@48..55 - FIELD_EXPR@48..55 - FIELD_EXPR@48..53 - PATH_EXPR@48..51 - PATH@48..51 - PATH_SEGMENT@48..51 - NAME_REF@48..51 - IDENT@48..51 "foo" - INDEX@51..53 ".0" - INDEX@53..55 ".1" - WHITESPACE@55..60 "\n " - EXPR_STMT@60..66 - FIELD_EXPR@60..66 - PATH_EXPR@60..63 - PATH@60..63 - PATH_SEGMENT@60..63 - NAME_REF@60..63 - IDENT@60..63 "foo" - INDEX@63..66 ".10" - WHITESPACE@66..71 "\n " - EXPR_STMT@71..76 - FIELD_EXPR@71..76 - PATH_EXPR@71..74 - PATH@71..74 - PATH_SEGMENT@71..74 - NAME_REF@71..74 - IDENT@71..74 "foo" - INDEX@74..76 ".0" - EXPR_STMT@76..77 - LITERAL@76..77 - INT_NUMBER@76..77 "1" - WHITESPACE@77..79 " " - COMMENT@79..91 "// index: .0" - WHITESPACE@91..96 "\n " - EXPR_STMT@96..101 - FIELD_EXPR@96..101 - PATH_EXPR@96..99 - PATH@96..99 - PATH_SEGMENT@96..99 - NAME_REF@96..99 - IDENT@96..99 "foo" - INDEX@99..101 ".0" - WHITESPACE@101..102 " " - EXPR_STMT@102..103 - LITERAL@102..103 - INT_NUMBER@102..103 "1" - WHITESPACE@103..104 " " - COMMENT@104..117 "// index: .0 " - WHITESPACE@117..122 "\n " - FIELD_EXPR@122..129 - FIELD_EXPR@122..127 - PATH_EXPR@122..125 - PATH@122..125 - PATH_SEGMENT@122..125 - NAME_REF@122..125 - IDENT@122..125 "foo" - DOT@125..126 "." - NAME_REF@126..127 - IDENT@126..127 "a" - INDEX@127..129 ".0" - WHITESPACE@129..130 "\n" - R_CURLY@130..131 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__struct_lit.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__struct_lit.snap deleted file mode 100644 index 11817e2c7..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__struct_lit.snap +++ /dev/null @@ -1,152 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn foo() {\n U;\n S {};\n S { x, y: 32, };\n S { x: 32, y: 64 };\n TupleStruct { 0: 1 };\n T(1.23);\n T(1.23, 4,)\n}" ---- -SOURCE_FILE@0..129 - FUNCTION_DEF@0..129 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..6 - IDENT@3..6 "foo" - PARAM_LIST@6..8 - L_PAREN@6..7 "(" - R_PAREN@7..8 ")" - WHITESPACE@8..9 " " - BLOCK_EXPR@9..129 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - EXPR_STMT@15..17 - PATH_EXPR@15..16 - PATH@15..16 - PATH_SEGMENT@15..16 - NAME_REF@15..16 - IDENT@15..16 "U" - SEMI@16..17 ";" - WHITESPACE@17..22 "\n " - EXPR_STMT@22..27 - RECORD_LIT@22..26 - PATH_TYPE@22..23 - PATH@22..23 - PATH_SEGMENT@22..23 - NAME_REF@22..23 - IDENT@22..23 "S" - WHITESPACE@23..24 " " - RECORD_FIELD_LIST@24..26 - L_CURLY@24..25 "{" - R_CURLY@25..26 "}" - SEMI@26..27 ";" - WHITESPACE@27..32 "\n " - EXPR_STMT@32..48 - RECORD_LIT@32..47 - PATH_TYPE@32..33 - PATH@32..33 - PATH_SEGMENT@32..33 - NAME_REF@32..33 - IDENT@32..33 "S" - WHITESPACE@33..34 " " - RECORD_FIELD_LIST@34..47 - L_CURLY@34..35 "{" - WHITESPACE@35..36 " " - RECORD_FIELD@36..37 - NAME_REF@36..37 - IDENT@36..37 "x" - COMMA@37..38 "," - WHITESPACE@38..39 " " - RECORD_FIELD@39..44 - NAME_REF@39..40 - IDENT@39..40 "y" - COLON@40..41 ":" - WHITESPACE@41..42 " " - LITERAL@42..44 - INT_NUMBER@42..44 "32" - COMMA@44..45 "," - WHITESPACE@45..46 " " - R_CURLY@46..47 "}" - SEMI@47..48 ";" - WHITESPACE@48..53 "\n " - EXPR_STMT@53..72 - RECORD_LIT@53..71 - PATH_TYPE@53..54 - PATH@53..54 - PATH_SEGMENT@53..54 - NAME_REF@53..54 - IDENT@53..54 "S" - WHITESPACE@54..55 " " - RECORD_FIELD_LIST@55..71 - L_CURLY@55..56 "{" - WHITESPACE@56..57 " " - RECORD_FIELD@57..62 - NAME_REF@57..58 - IDENT@57..58 "x" - COLON@58..59 ":" - WHITESPACE@59..60 " " - LITERAL@60..62 - INT_NUMBER@60..62 "32" - COMMA@62..63 "," - WHITESPACE@63..64 " " - RECORD_FIELD@64..69 - NAME_REF@64..65 - IDENT@64..65 "y" - COLON@65..66 ":" - WHITESPACE@66..67 " " - LITERAL@67..69 - INT_NUMBER@67..69 "64" - WHITESPACE@69..70 " " - R_CURLY@70..71 "}" - SEMI@71..72 ";" - WHITESPACE@72..77 "\n " - EXPR_STMT@77..98 - RECORD_LIT@77..97 - PATH_TYPE@77..88 - PATH@77..88 - PATH_SEGMENT@77..88 - NAME_REF@77..88 - IDENT@77..88 "TupleStruct" - WHITESPACE@88..89 " " - RECORD_FIELD_LIST@89..97 - L_CURLY@89..90 "{" - WHITESPACE@90..91 " " - RECORD_FIELD@91..95 - NAME_REF@91..92 - INT_NUMBER@91..92 "0" - COLON@92..93 ":" - WHITESPACE@93..94 " " - LITERAL@94..95 - INT_NUMBER@94..95 "1" - WHITESPACE@95..96 " " - R_CURLY@96..97 "}" - SEMI@97..98 ";" - WHITESPACE@98..103 "\n " - EXPR_STMT@103..111 - CALL_EXPR@103..110 - PATH_EXPR@103..104 - PATH@103..104 - PATH_SEGMENT@103..104 - NAME_REF@103..104 - IDENT@103..104 "T" - ARG_LIST@104..110 - L_PAREN@104..105 "(" - LITERAL@105..109 - FLOAT_NUMBER@105..109 "1.23" - R_PAREN@109..110 ")" - SEMI@110..111 ";" - WHITESPACE@111..116 "\n " - CALL_EXPR@116..127 - PATH_EXPR@116..117 - PATH@116..117 - PATH_SEGMENT@116..117 - NAME_REF@116..117 - IDENT@116..117 "T" - ARG_LIST@117..127 - L_PAREN@117..118 "(" - LITERAL@118..122 - FLOAT_NUMBER@118..122 "1.23" - COMMA@122..123 "," - WHITESPACE@123..124 " " - LITERAL@124..125 - INT_NUMBER@124..125 "4" - COMMA@125..126 "," - R_PAREN@126..127 ")" - WHITESPACE@127..128 "\n" - R_CURLY@128..129 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__type_alias_def.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__type_alias_def.snap deleted file mode 100644 index f8190e411..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__type_alias_def.snap +++ /dev/null @@ -1,35 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "type Foo = i32;\ntype Bar = Foo;" ---- -SOURCE_FILE@0..31 - TYPE_ALIAS_DEF@0..15 - TYPE_KW@0..4 "type" - WHITESPACE@4..5 " " - NAME@5..8 - IDENT@5..8 "Foo" - WHITESPACE@8..9 " " - EQ@9..10 "=" - WHITESPACE@10..11 " " - PATH_TYPE@11..14 - PATH@11..14 - PATH_SEGMENT@11..14 - NAME_REF@11..14 - IDENT@11..14 "i32" - SEMI@14..15 ";" - WHITESPACE@15..16 "\n" - TYPE_ALIAS_DEF@16..31 - TYPE_KW@16..20 "type" - WHITESPACE@20..21 " " - NAME@21..24 - IDENT@21..24 "Bar" - WHITESPACE@24..25 " " - EQ@25..26 "=" - WHITESPACE@26..27 " " - PATH_TYPE@27..30 - PATH@27..30 - PATH_SEGMENT@27..30 - NAME_REF@27..30 - IDENT@27..30 "Foo" - SEMI@30..31 ";" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__unary_expr.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__unary_expr.snap deleted file mode 100644 index a823815e6..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__unary_expr.snap +++ /dev/null @@ -1,53 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn foo() {\n let a = --3;\n let b = !!true;\n}" ---- -SOURCE_FILE@0..49 - FUNCTION_DEF@0..49 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..6 - IDENT@3..6 "foo" - PARAM_LIST@6..8 - L_PAREN@6..7 "(" - R_PAREN@7..8 ")" - WHITESPACE@8..9 " " - BLOCK_EXPR@9..49 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - LET_STMT@15..27 - LET_KW@15..18 "let" - WHITESPACE@18..19 " " - BIND_PAT@19..20 - NAME@19..20 - IDENT@19..20 "a" - WHITESPACE@20..21 " " - EQ@21..22 "=" - WHITESPACE@22..23 " " - PREFIX_EXPR@23..26 - MINUS@23..24 "-" - PREFIX_EXPR@24..26 - MINUS@24..25 "-" - LITERAL@25..26 - INT_NUMBER@25..26 "3" - SEMI@26..27 ";" - WHITESPACE@27..32 "\n " - LET_STMT@32..47 - LET_KW@32..35 "let" - WHITESPACE@35..36 " " - BIND_PAT@36..37 - NAME@36..37 - IDENT@36..37 "b" - WHITESPACE@37..38 " " - EQ@38..39 "=" - WHITESPACE@39..40 " " - PREFIX_EXPR@40..46 - EXCLAMATION@40..41 "!" - PREFIX_EXPR@41..46 - EXCLAMATION@41..42 "!" - LITERAL@42..46 - TRUE_KW@42..46 "true" - SEMI@46..47 ";" - WHITESPACE@47..48 "\n" - R_CURLY@48..49 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__use_.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__use_.snap deleted file mode 100644 index 5d9807ee9..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__use_.snap +++ /dev/null @@ -1,334 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "// Simple paths\n use package_name;\n use self::item_in_scope_or_package_name;\n use self::module::Item;\n use package::Item;\n use self::some::Struct;\n use package::some_item;\n\n // Use tree list\n use crate::{Item};\n use self::{Item};\n\n // Wildcard import\n use *; // Error\n use ::*; // Error\n use crate::*;\n use crate::{*};\n\n // Renames\n use some::path as some_name;\n use some::{\n other::path as some_other_name,\n different::path as different_name,\n yet::another::path,\n running::out::of::synonyms::for_::different::*\n };\n use Foo as _;" ---- -SOURCE_FILE@0..616 - COMMENT@0..15 "// Simple paths" - WHITESPACE@15..20 "\n " - USE@20..37 - USE_KW@20..23 "use" - WHITESPACE@23..24 " " - USE_TREE@24..36 - PATH@24..36 - PATH_SEGMENT@24..36 - NAME_REF@24..36 - IDENT@24..36 "package_name" - SEMI@36..37 ";" - WHITESPACE@37..42 "\n " - USE@42..82 - USE_KW@42..45 "use" - WHITESPACE@45..46 " " - USE_TREE@46..81 - PATH@46..81 - PATH@46..50 - PATH_SEGMENT@46..50 - SELF_KW@46..50 "self" - COLONCOLON@50..52 "::" - PATH_SEGMENT@52..81 - NAME_REF@52..81 - IDENT@52..81 "item_in_scope_or_pack ..." - SEMI@81..82 ";" - WHITESPACE@82..87 "\n " - USE@87..110 - USE_KW@87..90 "use" - WHITESPACE@90..91 " " - USE_TREE@91..109 - PATH@91..109 - PATH@91..103 - PATH@91..95 - PATH_SEGMENT@91..95 - SELF_KW@91..95 "self" - COLONCOLON@95..97 "::" - PATH_SEGMENT@97..103 - NAME_REF@97..103 - IDENT@97..103 "module" - COLONCOLON@103..105 "::" - PATH_SEGMENT@105..109 - NAME_REF@105..109 - IDENT@105..109 "Item" - SEMI@109..110 ";" - WHITESPACE@110..115 "\n " - USE@115..133 - USE_KW@115..118 "use" - WHITESPACE@118..119 " " - USE_TREE@119..132 - PATH@119..132 - PATH@119..126 - PATH_SEGMENT@119..126 - PACKAGE_KW@119..126 "package" - COLONCOLON@126..128 "::" - PATH_SEGMENT@128..132 - NAME_REF@128..132 - IDENT@128..132 "Item" - SEMI@132..133 ";" - WHITESPACE@133..138 "\n " - USE@138..161 - USE_KW@138..141 "use" - WHITESPACE@141..142 " " - USE_TREE@142..160 - PATH@142..160 - PATH@142..152 - PATH@142..146 - PATH_SEGMENT@142..146 - SELF_KW@142..146 "self" - COLONCOLON@146..148 "::" - PATH_SEGMENT@148..152 - NAME_REF@148..152 - IDENT@148..152 "some" - COLONCOLON@152..154 "::" - PATH_SEGMENT@154..160 - NAME_REF@154..160 - IDENT@154..160 "Struct" - SEMI@160..161 ";" - WHITESPACE@161..166 "\n " - USE@166..189 - USE_KW@166..169 "use" - WHITESPACE@169..170 " " - USE_TREE@170..188 - PATH@170..188 - PATH@170..177 - PATH_SEGMENT@170..177 - PACKAGE_KW@170..177 "package" - COLONCOLON@177..179 "::" - PATH_SEGMENT@179..188 - NAME_REF@179..188 - IDENT@179..188 "some_item" - SEMI@188..189 ";" - WHITESPACE@189..195 "\n\n " - COMMENT@195..211 "// Use tree list" - WHITESPACE@211..216 "\n " - USE@216..234 - USE_KW@216..219 "use" - WHITESPACE@219..220 " " - USE_TREE@220..233 - PATH@220..225 - PATH_SEGMENT@220..225 - NAME_REF@220..225 - IDENT@220..225 "crate" - COLONCOLON@225..227 "::" - USE_TREE_LIST@227..233 - L_CURLY@227..228 "{" - USE_TREE@228..232 - PATH@228..232 - PATH_SEGMENT@228..232 - NAME_REF@228..232 - IDENT@228..232 "Item" - R_CURLY@232..233 "}" - SEMI@233..234 ";" - WHITESPACE@234..239 "\n " - USE@239..256 - USE_KW@239..242 "use" - WHITESPACE@242..243 " " - USE_TREE@243..255 - PATH@243..247 - PATH_SEGMENT@243..247 - SELF_KW@243..247 "self" - COLONCOLON@247..249 "::" - USE_TREE_LIST@249..255 - L_CURLY@249..250 "{" - USE_TREE@250..254 - PATH@250..254 - PATH_SEGMENT@250..254 - NAME_REF@250..254 - IDENT@250..254 "Item" - R_CURLY@254..255 "}" - SEMI@255..256 ";" - WHITESPACE@256..262 "\n\n " - COMMENT@262..280 "// Wildcard import" - WHITESPACE@280..285 "\n " - USE@285..291 - USE_KW@285..288 "use" - WHITESPACE@288..289 " " - ERROR@289..290 - STAR@289..290 "*" - SEMI@290..291 ";" - WHITESPACE@291..292 " " - COMMENT@292..300 "// Error" - WHITESPACE@300..305 "\n " - USE@305..310 - USE_KW@305..308 "use" - WHITESPACE@308..309 " " - ERROR@309..310 - COLON@309..310 ":" - ERROR@310..311 - COLON@310..311 ":" - ERROR@311..312 - STAR@311..312 "*" - ERROR@312..313 - SEMI@312..313 ";" - WHITESPACE@313..314 " " - COMMENT@314..322 "// Error" - WHITESPACE@322..327 "\n " - USE@327..340 - USE_KW@327..330 "use" - WHITESPACE@330..331 " " - USE_TREE@331..339 - PATH@331..336 - PATH_SEGMENT@331..336 - NAME_REF@331..336 - IDENT@331..336 "crate" - COLONCOLON@336..338 "::" - STAR@338..339 "*" - SEMI@339..340 ";" - WHITESPACE@340..345 "\n " - USE@345..360 - USE_KW@345..348 "use" - WHITESPACE@348..349 " " - USE_TREE@349..359 - PATH@349..354 - PATH_SEGMENT@349..354 - NAME_REF@349..354 - IDENT@349..354 "crate" - COLONCOLON@354..356 "::" - USE_TREE_LIST@356..359 - L_CURLY@356..357 "{" - USE_TREE@357..358 - STAR@357..358 "*" - R_CURLY@358..359 "}" - SEMI@359..360 ";" - WHITESPACE@360..366 "\n\n " - COMMENT@366..376 "// Renames" - WHITESPACE@376..381 "\n " - USE@381..409 - USE_KW@381..384 "use" - WHITESPACE@384..385 " " - USE_TREE@385..408 - PATH@385..395 - PATH@385..389 - PATH_SEGMENT@385..389 - NAME_REF@385..389 - IDENT@385..389 "some" - COLONCOLON@389..391 "::" - PATH_SEGMENT@391..395 - NAME_REF@391..395 - IDENT@391..395 "path" - WHITESPACE@395..396 " " - RENAME@396..408 - AS_KW@396..398 "as" - WHITESPACE@398..399 " " - NAME@399..408 - IDENT@399..408 "some_name" - SEMI@408..409 ";" - WHITESPACE@409..414 "\n " - USE@414..598 - USE_KW@414..417 "use" - WHITESPACE@417..418 " " - USE_TREE@418..597 - PATH@418..422 - PATH_SEGMENT@418..422 - NAME_REF@418..422 - IDENT@418..422 "some" - COLONCOLON@422..424 "::" - USE_TREE_LIST@424..597 - L_CURLY@424..425 "{" - WHITESPACE@425..434 "\n " - USE_TREE@434..464 - PATH@434..445 - PATH@434..439 - PATH_SEGMENT@434..439 - NAME_REF@434..439 - IDENT@434..439 "other" - COLONCOLON@439..441 "::" - PATH_SEGMENT@441..445 - NAME_REF@441..445 - IDENT@441..445 "path" - WHITESPACE@445..446 " " - RENAME@446..464 - AS_KW@446..448 "as" - WHITESPACE@448..449 " " - NAME@449..464 - IDENT@449..464 "some_other_name" - COMMA@464..465 "," - WHITESPACE@465..474 "\n " - USE_TREE@474..507 - PATH@474..489 - PATH@474..483 - PATH_SEGMENT@474..483 - NAME_REF@474..483 - IDENT@474..483 "different" - COLONCOLON@483..485 "::" - PATH_SEGMENT@485..489 - NAME_REF@485..489 - IDENT@485..489 "path" - WHITESPACE@489..490 " " - RENAME@490..507 - AS_KW@490..492 "as" - WHITESPACE@492..493 " " - NAME@493..507 - IDENT@493..507 "different_name" - COMMA@507..508 "," - WHITESPACE@508..517 "\n " - USE_TREE@517..535 - PATH@517..535 - PATH@517..529 - PATH@517..520 - PATH_SEGMENT@517..520 - NAME_REF@517..520 - IDENT@517..520 "yet" - COLONCOLON@520..522 "::" - PATH_SEGMENT@522..529 - NAME_REF@522..529 - IDENT@522..529 "another" - COLONCOLON@529..531 "::" - PATH_SEGMENT@531..535 - NAME_REF@531..535 - IDENT@531..535 "path" - COMMA@535..536 "," - WHITESPACE@536..545 "\n " - USE_TREE@545..591 - PATH@545..588 - PATH@545..577 - PATH@545..571 - PATH@545..561 - PATH@545..557 - PATH@545..552 - PATH_SEGMENT@545..552 - NAME_REF@545..552 - IDENT@545..552 "running" - COLONCOLON@552..554 "::" - PATH_SEGMENT@554..557 - NAME_REF@554..557 - IDENT@554..557 "out" - COLONCOLON@557..559 "::" - PATH_SEGMENT@559..561 - NAME_REF@559..561 - IDENT@559..561 "of" - COLONCOLON@561..563 "::" - PATH_SEGMENT@563..571 - NAME_REF@563..571 - IDENT@563..571 "synonyms" - COLONCOLON@571..573 "::" - PATH_SEGMENT@573..577 - NAME_REF@573..577 - IDENT@573..577 "for_" - COLONCOLON@577..579 "::" - PATH_SEGMENT@579..588 - NAME_REF@579..588 - IDENT@579..588 "different" - COLONCOLON@588..590 "::" - STAR@590..591 "*" - WHITESPACE@591..596 "\n " - R_CURLY@596..597 "}" - SEMI@597..598 ";" - WHITESPACE@598..603 "\n " - USE@603..616 - USE_KW@603..606 "use" - WHITESPACE@606..607 " " - USE_TREE@607..615 - PATH@607..610 - PATH_SEGMENT@607..610 - NAME_REF@607..610 - IDENT@607..610 "Foo" - WHITESPACE@610..611 " " - RENAME@611..615 - AS_KW@611..613 "as" - WHITESPACE@613..614 " " - UNDERSCORE@614..615 "_" - SEMI@615..616 ";" -error Offset(289): expected one of `self`, `super`, `package` or an identifier -error Offset(309): expected one of `self`, `super`, `package` or an identifier -error Offset(310): expected SEMI -error Offset(310): expected a declaration -error Offset(311): expected a declaration -error Offset(312): expected a declaration - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__visibility.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__visibility.snap deleted file mode 100644 index 3e1b77cd4..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__visibility.snap +++ /dev/null @@ -1,94 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "pub struct Foo {};\npub(package) struct(gc) Baz {};\npub(super) fn foo() {}\npub(package) fn bar() {}\npub fn baz() {}" ---- -SOURCE_FILE@0..114 - STRUCT_DEF@0..18 - VISIBILITY@0..3 - PUB_KW@0..3 "pub" - WHITESPACE@3..4 " " - STRUCT_KW@4..10 "struct" - WHITESPACE@10..11 " " - NAME@11..14 - IDENT@11..14 "Foo" - WHITESPACE@14..15 " " - RECORD_FIELD_DEF_LIST@15..18 - L_CURLY@15..16 "{" - R_CURLY@16..17 "}" - SEMI@17..18 ";" - WHITESPACE@18..19 "\n" - STRUCT_DEF@19..50 - VISIBILITY@19..31 - PUB_KW@19..22 "pub" - L_PAREN@22..23 "(" - PACKAGE_KW@23..30 "package" - R_PAREN@30..31 ")" - WHITESPACE@31..32 " " - STRUCT_KW@32..38 "struct" - MEMORY_TYPE_SPECIFIER@38..42 - L_PAREN@38..39 "(" - GC_KW@39..41 "gc" - R_PAREN@41..42 ")" - WHITESPACE@42..43 " " - NAME@43..46 - IDENT@43..46 "Baz" - WHITESPACE@46..47 " " - RECORD_FIELD_DEF_LIST@47..50 - L_CURLY@47..48 "{" - R_CURLY@48..49 "}" - SEMI@49..50 ";" - FUNCTION_DEF@50..73 - WHITESPACE@50..51 "\n" - VISIBILITY@51..61 - PUB_KW@51..54 "pub" - L_PAREN@54..55 "(" - SUPER_KW@55..60 "super" - R_PAREN@60..61 ")" - WHITESPACE@61..62 " " - FN_KW@62..64 "fn" - WHITESPACE@64..65 " " - NAME@65..68 - IDENT@65..68 "foo" - PARAM_LIST@68..70 - L_PAREN@68..69 "(" - R_PAREN@69..70 ")" - WHITESPACE@70..71 " " - BLOCK_EXPR@71..73 - L_CURLY@71..72 "{" - R_CURLY@72..73 "}" - FUNCTION_DEF@73..98 - WHITESPACE@73..74 "\n" - VISIBILITY@74..86 - PUB_KW@74..77 "pub" - L_PAREN@77..78 "(" - PACKAGE_KW@78..85 "package" - R_PAREN@85..86 ")" - WHITESPACE@86..87 " " - FN_KW@87..89 "fn" - WHITESPACE@89..90 " " - NAME@90..93 - IDENT@90..93 "bar" - PARAM_LIST@93..95 - L_PAREN@93..94 "(" - R_PAREN@94..95 ")" - WHITESPACE@95..96 " " - BLOCK_EXPR@96..98 - L_CURLY@96..97 "{" - R_CURLY@97..98 "}" - FUNCTION_DEF@98..114 - WHITESPACE@98..99 "\n" - VISIBILITY@99..102 - PUB_KW@99..102 "pub" - WHITESPACE@102..103 " " - FN_KW@103..105 "fn" - WHITESPACE@105..106 " " - NAME@106..109 - IDENT@106..109 "baz" - PARAM_LIST@109..111 - L_PAREN@109..110 "(" - R_PAREN@110..111 ")" - WHITESPACE@111..112 " " - BLOCK_EXPR@112..114 - L_CURLY@112..113 "{" - R_CURLY@113..114 "}" - diff --git a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__while_expr.snap b/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__while_expr.snap deleted file mode 100644 index 7d37732e2..000000000 --- a/crates/mun_syntax/src/tests/snapshots/mun_syntax__tests__parser__while_expr.snap +++ /dev/null @@ -1,50 +0,0 @@ ---- -source: crates/mun_syntax/src/tests/parser.rs -expression: "fn foo() {\n while true {};\n while { true } {};\n}" ---- -SOURCE_FILE@0..54 - FUNCTION_DEF@0..54 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..6 - IDENT@3..6 "foo" - PARAM_LIST@6..8 - L_PAREN@6..7 "(" - R_PAREN@7..8 ")" - WHITESPACE@8..9 " " - BLOCK_EXPR@9..54 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - EXPR_STMT@15..29 - WHILE_EXPR@15..28 - WHILE_KW@15..20 "while" - WHITESPACE@20..21 " " - CONDITION@21..25 - LITERAL@21..25 - TRUE_KW@21..25 "true" - WHITESPACE@25..26 " " - BLOCK_EXPR@26..28 - L_CURLY@26..27 "{" - R_CURLY@27..28 "}" - SEMI@28..29 ";" - WHITESPACE@29..34 "\n " - EXPR_STMT@34..52 - WHILE_EXPR@34..51 - WHILE_KW@34..39 "while" - WHITESPACE@39..40 " " - CONDITION@40..48 - BLOCK_EXPR@40..48 - L_CURLY@40..41 "{" - WHITESPACE@41..42 " " - LITERAL@42..46 - TRUE_KW@42..46 "true" - WHITESPACE@46..47 " " - R_CURLY@47..48 "}" - WHITESPACE@48..49 " " - BLOCK_EXPR@49..51 - L_CURLY@49..50 "{" - R_CURLY@50..51 "}" - SEMI@51..52 ";" - WHITESPACE@52..53 "\n" - R_CURLY@53..54 "}" - diff --git a/crates/mun_target/Cargo.toml b/crates/mun_target/Cargo.toml index a49f79fd3..426fbcd09 100644 --- a/crates/mun_target/Cargo.toml +++ b/crates/mun_target/Cargo.toml @@ -17,4 +17,4 @@ log = "0.4.8" thiserror = "1.0.19" [dev-dependencies] -insta = "1.7.1" +insta = "1.12.0" diff --git a/crates/mun_target/tests/snapshots/data_layout__data_layout_darwin.snap b/crates/mun_target/tests/snapshots/data_layout__data_layout_darwin.snap index 45cbe4299..f9c07d34c 100644 --- a/crates/mun_target/tests/snapshots/data_layout__data_layout_darwin.snap +++ b/crates/mun_target/tests/snapshots/data_layout__data_layout_darwin.snap @@ -1,6 +1,8 @@ --- source: crates/mun_target/tests/data_layout.rs +assertion_line: 16 expression: layout + --- TargetDataLayout { endian: Little, diff --git a/crates/mun_target/tests/snapshots/data_layout__data_layout_linux.snap b/crates/mun_target/tests/snapshots/data_layout__data_layout_linux.snap index 45cbe4299..a62179d0e 100644 --- a/crates/mun_target/tests/snapshots/data_layout__data_layout_linux.snap +++ b/crates/mun_target/tests/snapshots/data_layout__data_layout_linux.snap @@ -1,6 +1,8 @@ --- source: crates/mun_target/tests/data_layout.rs +assertion_line: 24 expression: layout + --- TargetDataLayout { endian: Little, diff --git a/crates/mun_target/tests/snapshots/data_layout__data_layout_windows.snap b/crates/mun_target/tests/snapshots/data_layout__data_layout_windows.snap index 45cbe4299..9b938db3a 100644 --- a/crates/mun_target/tests/snapshots/data_layout__data_layout_windows.snap +++ b/crates/mun_target/tests/snapshots/data_layout__data_layout_windows.snap @@ -1,6 +1,8 @@ --- source: crates/mun_target/tests/data_layout.rs +assertion_line: 9 expression: layout + --- TargetDataLayout { endian: Little,